diff options
| author | Stephen Blott | 2017-09-07 14:15:46 +0100 |
|---|---|---|
| committer | Stephen Blott | 2017-09-07 14:15:46 +0100 |
| commit | a78246316b7062f9cd64226a885e1fb2b0cac6ee (patch) | |
| tree | edd89c48d487e5e53b4818d36da16bfce7a3832a /lib | |
| parent | 4df6b532d0925980e9542821d8bda400c981a5ac (diff) | |
| download | vimium-a78246316b7062f9cd64226a885e1fb2b0cac6ee.tar.bz2 | |
Use stubs from window.top for tests.
(Similar to idea suggested by @mrmr1993.)
This way:
- we do not have to replicate the stub code, and
- we have minimal impact on the live implementation.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/settings.coffee | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/settings.coffee b/lib/settings.coffee index eda02611..38718990 100644 --- a/lib/settings.coffee +++ b/lib/settings.coffee @@ -10,24 +10,8 @@ # # In all cases except Settings.defaults, values are stored as jsonified strings. -# This is a minimal stub of chrome services for the tests. This needs to be here (and not in -# ../tests/dom_tests/chrome.coffee) because the regular test stubs are not loaded in the Vomnibar or HUD -# iframes. -# NOTE(smblott): Possibly these should go in a separate file. -window.chrome ?= - runtime: - lastError: false - storage: - local: - get: -> - set: -> - sync: - get: (_, callback) -> callback? {} - set: -> - onChanged: - addListener: -> - extension: - inIncognitoContext: false +# If the current frame is the Vomnibar or the HUD, then we'll need our Chrome stubs for the tests. +window.chrome ?= window.top?.chrome storageArea = if chrome.storage.sync? then "sync" else "local" |
