Skip to content

Commit bd8257d

Browse files
committed
add new test case "plugin"
1 parent 1a0fa60 commit bd8257d

File tree

6 files changed

+116
-0
lines changed

6 files changed

+116
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
3+
<head>
4+
<title>SWFObject - step 1</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
6+
</head>
7+
<body>
8+
<div>
9+
10+
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
11+
<param name="movie" value="relog.swf" />
12+
<!--[if !IE]>-->
13+
<object type="application/x-shockwave-flash" data="relog.swf" width="780" height="420">
14+
<!--<![endif]-->
15+
<p>Alternative content</p>
16+
<!--[if !IE]>-->
17+
</object>
18+
<!--<![endif]-->
19+
20+
21+
<script>
22+
var gui = require('nw.gui');
23+
var result = { ok: true };
24+
25+
var socket = require('net').connect({port: 13013});
26+
socket.setEncoding('utf8');
27+
socket.end(JSON.stringify(result));
28+
29+
30+
</script>
31+
32+
</object>
33+
</div>
34+
</body>
35+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"main": "index.html",
3+
"name": "nw-demo",
4+
"description": "demo app of node-webkit",
5+
"version": "0.1",
6+
"keywords": [ "demo", "node-webkit" ],
7+
"window": {
8+
"toolbar": true,
9+
"width": 800,
10+
"height": 500,
11+
"position": "mouse",
12+
"min_width": 400,
13+
"min_height": 200,
14+
"max_width": 800,
15+
"max_height": 600
16+
},
17+
"webkit": {
18+
"plugin": true
19+
}
20+
}
1.78 KB
Binary file not shown.

tests/automation/plugin/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>plugin test</title>
6+
</head>
7+
<body>
8+
<p>plugin test</p>
9+
10+
<script src="../res/mocha_util.js"></script>
11+
<script src="mocha_test.js"></script>
12+
13+
</body>
14+
15+
</html>
16+

tests/automation/plugin/mocha_test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
var path = require('path');
2+
var assert = require('assert');
3+
var fs = require('fs-extra');
4+
var curDir = fs.realpathSync('.');
5+
6+
describe('Plugin', function() {
7+
8+
describe('flash', function(){
9+
10+
var server, child, result = false;
11+
12+
before(function(done) {
13+
server = createTCPServer(13013);
14+
child = spawnChildProcess(path.join(curDir, 'flash'));
15+
server.on('connection', function(socket) {
16+
socket.setEncoding('utf8');
17+
socket.on('data', function(data) {
18+
result = true;
19+
child.kill();
20+
done();
21+
});
22+
});
23+
24+
});
25+
26+
after(function () {
27+
server.close();
28+
});
29+
30+
it('should not crash', function() {
31+
32+
assert.equal(result, true);
33+
34+
});
35+
36+
});
37+
38+
});
39+
40+

tests/automation/plugin/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name":"plugin_wrapper",
3+
"main":"index.html"
4+
}
5+

0 commit comments

Comments
 (0)