From: Cheng Zhao Date: Wed, 15 Jun 2016 12:12:06 +0000 (+0900) Subject: spec: Correctly cleanup the protocol test X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=335cd8779c2f55e3581f34e6b1a8773cbc6eab2e;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git spec: Correctly cleanup the protocol test --- diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index 9529ec5..25a09ba 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -18,7 +18,7 @@ describe('session module', function () { var url = 'http://127.0.0.1' var partitionName = 'temp' var protocolName = 'sp' - const tempProtocol = session.fromPartition(partitionName).protocol + const partitionProtocol = session.fromPartition(partitionName).protocol const protocol = session.defaultSession.protocol 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) { var handler = function (error, callback) { callback({ data: 'test' }) } - tempProtocol.registerStringProtocol(protocolName, handler, function (error) { + partitionProtocol.registerStringProtocol(protocolName, handler, function (error) { if (error) { return done(error) } protocol.isProtocolHandled(protocolName, function (result) { assert.equal(result, false) - tempProtocol.isProtocolHandled(protocolName, function (result) { + partitionProtocol.isProtocolHandled(protocolName, function (result) { assert.equal(result, true) w.webContents.on('did-finish-load', function () { done()