diff options
| author | Stephen Blott | 2017-09-04 08:22:40 +0100 |
|---|---|---|
| committer | Stephen Blott | 2017-09-04 08:22:40 +0100 |
| commit | 4df6b532d0925980e9542821d8bda400c981a5ac (patch) | |
| tree | 26db62dfea2f4832fae94db08c2873427fac84a5 /lib | |
| parent | 1e3a618b89d053f16715790f539350680b993b0f (diff) | |
| download | vimium-4df6b532d0925980e9542821d8bda400c981a5ac.tar.bz2 | |
Fix tests for #2626.
This fixes the tests for #2626.
Note: This may not be th best approach.
The problem is that, for the first time, we're using `Settings` (and
hence `chrome.storage`) within the Vomnibar and HUD iframes, and our
`chrome` stubs are not injected into those frames.
Mention @mrmr1993. Matt: Do you know of a better approach? Can we
inject the stubs programmatically in the tests? An alternative approach
would be appreciated.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/settings.coffee | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/settings.coffee b/lib/settings.coffee index f5fc16b0..eda02611 100644 --- a/lib/settings.coffee +++ b/lib/settings.coffee @@ -10,6 +10,25 @@ # # 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 + storageArea = if chrome.storage.sync? then "sync" else "local" Settings = |
