Skip to content

Commit 1a0fa60

Browse files
committed
add new test case "nw-in-mem"
1 parent 89ded47 commit 1a0fa60

File tree

15 files changed

+194
-0
lines changed

15 files changed

+194
-0
lines changed

tests/automation/nw-in-mem/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>nw_in_mem test</title>
6+
</head>
7+
<body>
8+
<p>nw in men 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+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var os = require('os');
2+
var path = require('path');
3+
var fs = require('fs-extra');
4+
var curDir = fs.realpathSync('.');
5+
6+
var exec = require('child_process').exec;
7+
var spawn = require('child_process').spawn;
8+
9+
describe('nw in memory after quiting',function(){
10+
11+
it('nw.exe should not be in memory after gui.App.quit is called on windows',function(done){
12+
this.timeout(0);
13+
if(os.platform() == "win32") {
14+
var app = spawn(process.execPath, [path.join(curDir,'package')])
15+
app.on('close',function(){
16+
var nwname = "nw.exe";
17+
var nwcount = 0;
18+
setTimeout(function() {
19+
exec("tasklist", function(err, stdout, stderr) {
20+
if(err){ return console.log(err); }
21+
stdout.split('\n').filter(function(line){
22+
var p=line.trim().split(/\s+/),pname=p[0];
23+
if(pname.toLowerCase().indexOf(nwname)>=0)
24+
nwcount++;
25+
});
26+
27+
if(nwcount == 2)
28+
done();
29+
else if(nwcount > 2)
30+
done('nw.exe is still in memory after the quit of app');
31+
})
32+
}, 500);
33+
});
34+
}
35+
else
36+
done();
37+
});
38+
39+
40+
});
41+
42+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name":"nw_in_mem_wrapper",
3+
"main":"index.html"
4+
}
29.1 KB
Loading

tests/automation/nw-in-mem/package/c2runtime.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
24.6 KB
Loading
32.6 KB
Loading
1.02 KB
Loading
2.9 KB
Loading

0 commit comments

Comments
 (0)