Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 Cu.import("resource://services-sync/engines/tabs.js");
5 Cu.import("resource://services-sync/service.js");
6 Cu.import("resource://services-sync/util.js");
8 function getMocks() {
9 let engine = new TabEngine(Service);
10 let store = engine._store;
11 store.getTabState = mockGetTabState;
12 store.shouldSkipWindow = mockShouldSkipWindow;
13 return [engine, store];
14 }
16 function run_test() {
17 _("Test getOpenURLs.");
18 let [engine, store] = getMocks();
20 let urls = ["http://bar.com", "http://foo.com", "http://foobar.com"];
21 function threeURLs() {
22 return urls.pop();
23 }
24 store.getWindowEnumerator = mockGetWindowEnumerator.bind(this, threeURLs, 1, 3);
26 let matches;
28 _(" test matching works (true)");
29 let openurlsset = engine.getOpenURLs();
30 matches = openurlsset.has("http://foo.com");
31 do_check_true(matches);
33 _(" test matching works (false)");
34 matches = openurlsset.has("http://barfoo.com");
35 do_check_false(matches);
36 }