File tree Expand file tree Collapse file tree 2 files changed +20
-26
lines changed
tests/automatic_tests/crashonreload Expand file tree Collapse file tree 2 files changed +20
-26
lines changed Original file line number Diff line number Diff line change 10
10
var gui = require ( 'nw.gui' ) ;
11
11
var win = gui . Window . get ( ) ;
12
12
win . showDevTools ( 'devtools' ) ;
13
- setTimeout ( function ( ) {
14
- location . reload ( ) ;
15
- } , 2000 ) ;
16
- setTimeout ( function ( ) {
17
- var client = require ( '../../nw_test_app' ) . createClient ( {
18
- argv : gui . App . argv ,
19
- data : 'ok'
20
- } ) ;
21
- } , 3000 ) ;
13
+
14
+ win . on ( 'loaded' , function ( ) {
15
+ setTimeout ( function ( ) {
16
+ location . reload ( ) ;
17
+ } , 1000 ) ;
18
+ } )
22
19
</ script >
23
20
</ body >
24
21
</ html >
Original file line number Diff line number Diff line change
1
+ var spawn = require ( 'child_process' ) . spawn ;
2
+ var path = require ( 'path' ) ;
1
3
var app_test = require ( './nw_test_app' ) ;
2
4
describe ( 'crash on reload' , function ( ) {
3
5
it ( 'nw should not crash when reloading with devtool opened' , function ( done ) {
4
6
this . timeout ( 0 ) ;
5
7
var result = false ;
6
- var child = app_test . createChildProcess ( {
7
- execPath : process . execPath ,
8
- appPath : path . join ( global . tests_dir , 'crashonreload' ) ,
9
- end : function ( data , app ) {
8
+ var exec_argv = [ path . join ( global . tests_dir , 'crashonreload' ) ] ;
9
+
10
+ var app = spawn ( process . execPath , exec_argv ) ;
11
+ app . on ( 'exit' , function ( code ) {
12
+ if ( code != 0 ) return done ( 'nw crashes' ) ;
13
+ result = true ;
14
+ done ( ) ;
15
+ } ) ;
16
+ setTimeout ( function ( ) {
17
+ if ( ! result ) {
10
18
app . kill ( ) ;
11
- result = true ;
12
- if ( data == 'ok' ) {
13
- done ( ) ;
14
- }
15
- else
16
- done ( 'the nw crashes' ) ;
19
+ done ( ) ;
17
20
}
18
- } ) ;
19
- setTimeout ( function ( ) {
20
- if ( ! result ) {
21
- child . close ( ) ;
22
- done ( 'nw crashes when reloading with devtool opened' ) ;
23
- }
24
- } , 4000 ) ;
21
+ } , 7500 ) ;
25
22
} )
26
23
} )
You can’t perform that action at this time.
0 commit comments