]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix refreshing test window
authorCheng Zhao <zcbenz@gmail.com>
Fri, 5 Jun 2015 11:48:58 +0000 (19:48 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 5 Jun 2015 11:48:58 +0000 (19:48 +0800)
spec/api-crash-reporter-spec.coffee
spec/static/main.js

index fc93eb304b652e68a7a1ecbe08e98ed874ad93a2..6cd7142153544e3170849d64dfc9e6eed5cc0008 100644 (file)
@@ -39,8 +39,12 @@ describe 'crash-reporter module', ->
         res.end('abc-123-def')
         server.close()
         done()
-    server.listen 0, '127.0.0.1', ->
+    # Server port is generated randomly for the first run, it will be reused
+    # when page is refreshed.
+    port = remote.process.port
+    server.listen port, '127.0.0.1', ->
       {port} = server.address()
+      remote.process.port = port
       url = url.format
         protocol: 'file'
         pathname: path.join fixtures, 'api', 'crash.html'
index df9f19a630e24b7eafba2545e20a56dea4d03863..601926716e963d47de783d1c15edd93933080c41 100644 (file)
@@ -5,6 +5,7 @@ var BrowserWindow = require('browser-window');
 var Menu = require('menu');
 
 var window = null;
+process.port = 0;  // will be used by crash-reporter spec.
 
 app.commandLine.appendSwitch('js-flags', '--expose_gc');
 app.commandLine.appendSwitch('ignore-certificate-errors');