diff options
Diffstat (limited to 'services/sync/tests/unit/test_tab_store.js')
-rw-r--r-- | services/sync/tests/unit/test_tab_store.js | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/services/sync/tests/unit/test_tab_store.js b/services/sync/tests/unit/test_tab_store.js index 93b60f0c7..f8265492f 100644 --- a/services/sync/tests/unit/test_tab_store.js +++ b/services/sync/tests/unit/test_tab_store.js @@ -20,26 +20,32 @@ function test_create() { _("Create a first record"); let rec = {id: "id1", clientName: "clientName1", - cleartext: { "foo": "bar" }, + cleartext: "cleartext1", modified: 1000}; store.applyIncoming(rec); - deepEqual(store._remoteClients["id1"], { lastModified: 1000, foo: "bar" }); + do_check_eq(store._remoteClients["id1"], "cleartext1"); + do_check_eq(Svc.Prefs.get("notifyTabState"), 1); _("Create a second record"); rec = {id: "id2", clientName: "clientName2", - cleartext: { "foo2": "bar2" }, + cleartext: "cleartext2", modified: 2000}; store.applyIncoming(rec); - deepEqual(store._remoteClients["id2"], { lastModified: 2000, foo2: "bar2" }); + do_check_eq(store._remoteClients["id2"], "cleartext2"); + do_check_eq(Svc.Prefs.get("notifyTabState"), 0); _("Create a third record"); rec = {id: "id3", clientName: "clientName3", - cleartext: { "foo3": "bar3" }, + cleartext: "cleartext3", modified: 3000}; store.applyIncoming(rec); - deepEqual(store._remoteClients["id3"], { lastModified: 3000, foo3: "bar3" }); + do_check_eq(store._remoteClients["id3"], "cleartext3"); + do_check_eq(Svc.Prefs.get("notifyTabState"), 0); + + // reset the notifyTabState + Svc.Prefs.reset("notifyTabState"); } function test_getAllTabs() { @@ -53,20 +59,20 @@ function test_getAllTabs() { _("Get all tabs."); tabs = store.getAllTabs(); _("Tabs: " + JSON.stringify(tabs)); - equal(tabs.length, 1); - equal(tabs[0].title, "title"); - equal(tabs[0].urlHistory.length, 2); - equal(tabs[0].urlHistory[0], "http://foo.com"); - equal(tabs[0].urlHistory[1], "http://bar.com"); - equal(tabs[0].icon, "image"); - equal(tabs[0].lastUsed, 1); + do_check_eq(tabs.length, 1); + do_check_eq(tabs[0].title, "title"); + do_check_eq(tabs[0].urlHistory.length, 2); + do_check_eq(tabs[0].urlHistory[0], "http://foo.com"); + do_check_eq(tabs[0].urlHistory[1], "http://bar.com"); + do_check_eq(tabs[0].icon, "image"); + do_check_eq(tabs[0].lastUsed, 1); _("Get all tabs, and check that filtering works."); let twoUrls = ["about:foo", "http://fuubar.com"]; store.getWindowEnumerator = mockGetWindowEnumerator.bind(this, "http://foo.com", 1, 1, () => 2, () => twoUrls); tabs = store.getAllTabs(true); _("Filtered: " + JSON.stringify(tabs)); - equal(tabs.length, 0); + do_check_eq(tabs.length, 0); _("Get all tabs, and check that the entries safety limit works."); let allURLs = []; @@ -79,10 +85,10 @@ function test_getAllTabs() { tabs = store.getAllTabs((url) => url.startsWith("about")); _("Sliced: " + JSON.stringify(tabs)); - equal(tabs.length, 1); - equal(tabs[0].urlHistory.length, 25); - equal(tabs[0].urlHistory[0], "http://foo40.bar"); - equal(tabs[0].urlHistory[24], "http://foo16.bar"); + do_check_eq(tabs.length, 1); + do_check_eq(tabs[0].urlHistory.length, 25); + do_check_eq(tabs[0].urlHistory[0], "http://foo40.bar"); + do_check_eq(tabs[0].urlHistory[24], "http://foo16.bar"); } function test_createRecord() { @@ -99,14 +105,14 @@ function test_createRecord() { store.getWindowEnumerator = mockGetWindowEnumerator.bind(this, "http://foo.com", 1, 1); record = store.createRecord("fake-guid"); - ok(record instanceof TabSetRecord); - equal(record.tabs.length, 1); + do_check_true(record instanceof TabSetRecord); + do_check_eq(record.tabs.length, 1); _("create a big record"); store.getWindowEnumerator = mockGetWindowEnumerator.bind(this, "http://foo.com", 1, numtabs); record = store.createRecord("fake-guid"); - ok(record instanceof TabSetRecord); - equal(record.tabs.length, 256); + do_check_true(record instanceof TabSetRecord); + do_check_eq(record.tabs.length, 256); } function run_test() { |