Update cookies spec.

This commit is contained in:
Haojian Wu 2015-06-20 10:42:18 +08:00
parent bafbee805c
commit db23d1165c

View file

@ -7,7 +7,7 @@ BrowserWindow = remote.require 'browser-window'
describe 'cookies module', ->
fixtures = path.resolve __dirname, 'fixtures'
w = null
url = "http://127.0.0.1:9999"
url = "http://127.0.0.1"
beforeEach -> w = new BrowserWindow(show: true)
afterEach -> w.destroy()
@ -17,10 +17,12 @@ describe 'cookies module', ->
console.log req
res.setHeader('Set-Cookie', ['type=dummy'])
res.end('finished')
server.close()
server.listen 9999, '127.0.0.1', ->
port = remote.process.port
server.listen port, '127.0.0.1', ->
{port} = server.address()
w.loadUrl url
w.loadUrl "#{url}:#{port}"
w.webContents.on 'did-finish-load', ()->
w.webContents.session.cookies.get {url: url}, (error, cookies) ->
throw error if error