var os = require('os');
var path = require('path');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
describe('nw in memory after quiting',function(){
	it('nw.exe should not be in memory after gui.App.quit is called on windows',function(done){
		this.timeout(0);
		if(os.platform() == "win32") {
			var app = spawn(process.execPath, [path.join(global.tests_dir,'nw-in-mem/package')])
			app.on('close',function(){
				var nwname = "nw.exe";
				var nwcount = 0;
				exec("tasklist", function(err, stdout, stderr) {
					if(err){ return console.log(err); }
					stdout.split('\n').filter(function(line){
		        var p=line.trim().split(/\s+/),pname=p[0];
		        if(pname.toLowerCase().indexOf(nwname)>=0)
		            nwcount++;
	    		});

		  		if(nwcount == 2)
		  			done();
		  		else if(nwcount > 2)
		  			done('nw.exe is still in memory after the quit of app');
				})
			});
		}
		else 
			done();
	})
})
@@ -181,17 +181,18 @@
 tion()%7B%0A
-%09
+  
 it('nw.e
@@ -275,18 +275,20 @@
 (done)%7B%0A
-%09%09
+    
 this.tim
@@ -296,18 +296,20 @@
 out(0);%0A
-%09%09
+    
 if(os.pl
@@ -331,19 +331,22 @@
 n32%22) %7B%0A
-%09%09%09
+      
 var app 
@@ -422,19 +422,22 @@
 age')%5D)%0A
-%09%09%09
+      
 app.on('
@@ -455,20 +455,24 @@
 tion()%7B%0A
-%09%09%09%09
+        
 var nwna
@@ -486,20 +486,24 @@
 w.exe%22;%0A
-%09%09%09%09
+        
 var nwco
@@ -511,20 +511,58 @@
 nt = 0;%0A
-%09%09%09%09
+        setTimeout(function() %7B%0A          
 exec(%22ta
@@ -602,21 +602,28 @@
 derr) %7B%0A
-%09%09%09%09%09
+            
 if(err)%7B
@@ -654,13 +654,20 @@
 ; %7D%0A
-%09%09%09%09%09
+            
 stdo
@@ -704,18 +704,22 @@
 (line)%7B%0A
-%09%09
+      
         
@@ -761,26 +761,26 @@
 e=p%5B0%5D;%0A
-%09%09
+  
         
 if(pname
@@ -771,16 +771,20 @@
         
+    
 if(pname
@@ -818,18 +818,22 @@
 me)%3E=0)%0A
-%09%09
+      
         
@@ -851,64 +851,88 @@
 ++;%0A
-%09    %09%09%7D);%0A%0A%09%09  %09%09if(nwcount == 2)%0A%09%09  %09%09%09done();%0A%09%09  %09%09
+            %7D);%0A%0A            if(nwcount == 2)%0A              done();%0A            
 else
@@ -952,15 +952,22 @@
  2)%0A
-%09%09  %09%09%09
+              
 done
@@ -1023,45 +1023,78 @@
 ');%0A
-%09%09%09%09%7D)%0A%09%09%09%7D);%0A%09%09%7D%0A%09%09else %0A%09%09%09
+          %7D)%0A        %7D, 500);%0A      %7D);%0A    %7D%0A    else %0A      
 done();%0A
 %09%7D)%0A
@@ -1093,9 +1093,10 @@
 ();%0A
-%09
+  
 %7D)%0A%7D

revise the timeout of nw-in-mem test