diff options
author | Ruben Rodriguez <ruben@gnu.org> | 2018-02-25 20:04:31 -0500 |
---|---|---|
committer | Ruben Rodriguez <ruben@gnu.org> | 2018-02-25 20:04:31 -0500 |
commit | 229240370f009a7ba1dc31f57bcfcbd2cf785d0a (patch) | |
tree | defa51219f44d19451bbcfd1e8298eadb1e3f4b7 /data/extensions/https-everywhere@eff.org/test/incognito_test.js | |
parent | f2a3be07039056c76e3ca4e6040ec900ba64f376 (diff) |
Updated extensions
- HTTPS Everywhere updated to 2018.1.11
- "goteo.org payments with free JS" updated to 1.1
- "LibreJS compatible Pay.gov" updated to 1.3
- "Reveal hidden HTML" updated to 1.6
- Enabled WebRTC, but prevent leaking the LAN ip.
Diffstat (limited to 'data/extensions/https-everywhere@eff.org/test/incognito_test.js')
-rw-r--r-- | data/extensions/https-everywhere@eff.org/test/incognito_test.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/data/extensions/https-everywhere@eff.org/test/incognito_test.js b/data/extensions/https-everywhere@eff.org/test/incognito_test.js new file mode 100644 index 0000000..4005515 --- /dev/null +++ b/data/extensions/https-everywhere@eff.org/test/incognito_test.js @@ -0,0 +1,59 @@ +'use strict' + +const expect = require('chai').expect, + tu = require('./testing_utils'), + incognito = require('../incognito'); + +describe('incognito.js', function() { + beforeEach(function() { + tu.stubber([ + ['chrome.windows.onCreated.addListener', tu.Mock()], + ['chrome.windows.onRemoved.addListener', tu.Mock()], + ['chrome.windows.getAll', tu.Mock()], + ]); + }); + + describe('onIncognitoDestruction', function() { + beforeEach(function() { + incognito.state.incognito_session_exists = false; + this.callbackCalled = false; + this.callback = () => this.callbackCalled = true; + this.instance = incognito.onIncognitoDestruction(this.callback); + }) + + it('no incognito session by default', function() { + expect(incognito.state.incognito_session_exists).to.be.false; + }) + + it('with no incognito, callback not called', async function() { + incognito.state.incognito_session_exists = false; + + await this.instance.detect_incognito_destruction(); + + expect(this.callbackCalled).to.be.false; + }); + + it('with incognitos still open, callback not called', async function() { + incognito.state.incognito_session_exists = true; + chrome.windows.getAll = func => func([{incognito: true}]); + + await this.instance.detect_incognito_destruction(); + + expect(this.callbackCalled, 'not called').to.be.false; + }); + + it('callback called when last incognito closed', async function() { + incognito.state.incognito_session_exists = true; + chrome.windows.getAll = func => func([]); + + await this.instance.detect_incognito_destruction(); + expect(incognito.state.incognito_session_exists, 'constant changed').to.be.false; + expect(this.callbackCalled).to.be.true; + }); + + it('detects when an incognito window is created', function() { + this.instance.detect_incognito_creation({incognito: true}); + expect(incognito.state.incognito_session_exists, 'constant changed').to.be.true; + }) + }); +}); |