File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
tests/automatic_tests/after_close_previous_window_then_open_new Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ </ head >
4
+ < body >
5
+ hi
6
+ < script >
7
+ var gui = require ( 'nw.gui' ) ;
8
+ //The test case require crash dump api
9
+ gui . App . setCrashDumpDir ( './automatic_tests/after_close_previous_window_then_open_new/tmp' ) ;
10
+ var win = gui . Window . get ( window . open ( 'http://www.google.com' ) )
11
+ win . close ( true ) ;
12
+ setTimeout ( function ( ) {
13
+ gui . Window . open ( 'http://www.google.com' )
14
+ } , 1000 ) ;
15
+ setTimeout ( gui . App . quit , 1500 ) ;
16
+ </ script >
17
+ </ body >
18
+ </ html >
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' ) ;
2
+ var app_test = require ( './nw_test_app' ) ;
3
+ var assert = require ( 'assert' ) ;
4
+ var fs = require ( 'fs' ) ;
5
+ var fs_extra = require ( 'fs-extra' ) ;
6
+ var spawn = require ( 'child_process' ) . spawn ;
7
+ var result ;
8
+
9
+ describe ( 'afterpp close previous window then open new' , function ( ) {
10
+ after ( function ( ) {
11
+ fs_extra . remove ( './automatic_tests/after_close_previous_window_then_open_new/tmp' , function ( er ) {
12
+ if ( er ) throw er ;
13
+ } ) ;
14
+ } ) ;
15
+
16
+ before ( function ( done ) {
17
+ this . timeout ( 0 ) ;
18
+ fs . mkdirSync ( './automatic_tests/after_close_previous_window_then_open_new/tmp' ) ;
19
+
20
+ var appPath = path . join ( global . tests_dir , 'after_close_previous_window_then_open_new' ) ;
21
+
22
+ var exec_argv = [ appPath ] ;
23
+ app = spawn ( process . execPath , exec_argv ) ;
24
+ setTimeout ( function ( ) {
25
+ done ( ) ;
26
+ } , 2000 ) ;
27
+ } ) ;
28
+
29
+ it ( 'should not crash' , function ( ) {
30
+ result = fs . readdirSync ( './automatic_tests/after_close_previous_window_then_open_new/tmp' ) ;
31
+ assert . equal ( result . length , 0 ) ;
32
+ } ) ;
33
+
34
+ } ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " nw-#1236" ,
3
+ "main" : " index.html"
4
+ }
You can’t perform that action at this time.
0 commit comments