spec: Correctly cleanup the protocol test
This commit is contained in:
parent
fe0e17d1c3
commit
335cd8779c
1 changed files with 7 additions and 3 deletions
|
@ -18,7 +18,7 @@ describe('session module', function () {
|
||||||
var url = 'http://127.0.0.1'
|
var url = 'http://127.0.0.1'
|
||||||
var partitionName = 'temp'
|
var partitionName = 'temp'
|
||||||
var protocolName = 'sp'
|
var protocolName = 'sp'
|
||||||
const tempProtocol = session.fromPartition(partitionName).protocol
|
const partitionProtocol = session.fromPartition(partitionName).protocol
|
||||||
const protocol = session.defaultSession.protocol
|
const protocol = session.defaultSession.protocol
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
@ -288,19 +288,23 @@ describe('session module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function (done) {
|
||||||
|
partitionProtocol.unregisterProtocol(protocolName, () => done())
|
||||||
|
})
|
||||||
|
|
||||||
it('handles requests from a partition', function (done) {
|
it('handles requests from a partition', function (done) {
|
||||||
var handler = function (error, callback) {
|
var handler = function (error, callback) {
|
||||||
callback({
|
callback({
|
||||||
data: 'test'
|
data: 'test'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
tempProtocol.registerStringProtocol(protocolName, handler, function (error) {
|
partitionProtocol.registerStringProtocol(protocolName, handler, function (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
return done(error)
|
return done(error)
|
||||||
}
|
}
|
||||||
protocol.isProtocolHandled(protocolName, function (result) {
|
protocol.isProtocolHandled(protocolName, function (result) {
|
||||||
assert.equal(result, false)
|
assert.equal(result, false)
|
||||||
tempProtocol.isProtocolHandled(protocolName, function (result) {
|
partitionProtocol.isProtocolHandled(protocolName, function (result) {
|
||||||
assert.equal(result, true)
|
assert.equal(result, true)
|
||||||
w.webContents.on('did-finish-load', function () {
|
w.webContents.on('did-finish-load', function () {
|
||||||
done()
|
done()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue