зеркало из https://github.com/mozilla/gecko-dev.git
Bug 735868 - Fix tests r=rnewman
This commit is contained in:
Родитель
d1835f40b2
Коммит
e330f0a9c6
|
@ -46,10 +46,8 @@ add_task(function test_locally_changed_keys() {
|
|||
}],
|
||||
attributes: {
|
||||
image: "image"
|
||||
},
|
||||
extData: {
|
||||
weaveLastUsed: 1
|
||||
}}]}]};
|
||||
}
|
||||
}]}]};
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
getBrowserState: function () JSON.stringify(myTabs)
|
||||
|
|
|
@ -54,10 +54,8 @@ add_test(function v4_upgrade() {
|
|||
}],
|
||||
attributes: {
|
||||
image: "image"
|
||||
},
|
||||
extData: {
|
||||
weaveLastUsed: 1
|
||||
}}]}]};
|
||||
}
|
||||
}]}]};
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
getBrowserState: function () JSON.stringify(myTabs)
|
||||
|
@ -225,10 +223,8 @@ add_test(function v5_upgrade() {
|
|||
}],
|
||||
attributes: {
|
||||
image: "image"
|
||||
},
|
||||
extData: {
|
||||
weaveLastUsed: 1
|
||||
}}]}]};
|
||||
}
|
||||
}]}]};
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
getBrowserState: function () JSON.stringify(myTabs)
|
||||
|
|
|
@ -16,9 +16,6 @@ function fakeSessionSvc() {
|
|||
}],
|
||||
attributes: {
|
||||
image: "image"
|
||||
},
|
||||
extData: {
|
||||
weaveLastUsed: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,25 +6,6 @@ Cu.import("resource://services-sync/service.js");
|
|||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://testing-common/services-common/utils.js");
|
||||
|
||||
function test_lastUsed() {
|
||||
let store = new TabEngine(Service)._store;
|
||||
|
||||
_("Check extraction of last used times from tab objects.");
|
||||
let expected = [
|
||||
[0, {}],
|
||||
[0, {extData: null}],
|
||||
[0, {extData: {}}],
|
||||
[0, {extData: {weaveLastUsed: null}}],
|
||||
[123456789, {extData: {weaveLastUsed: "123456789"}}],
|
||||
[123456789, {extData: {weaveLastUsed: 123456789}}],
|
||||
[123456789, {extData: {weaveLastUsed: 123456789.12}}]
|
||||
];
|
||||
|
||||
for each (let [ex, input] in expected) {
|
||||
do_check_eq(ex, store.tabLastUsed(input));
|
||||
}
|
||||
}
|
||||
|
||||
function test_create() {
|
||||
let store = new TabEngine(Service)._store;
|
||||
|
||||
|
@ -76,9 +57,7 @@ function fakeSessionSvc(url, numtabs) {
|
|||
attributes: {
|
||||
image: "image"
|
||||
},
|
||||
extData: {
|
||||
weaveLastUsed: 1
|
||||
}
|
||||
lastAccessed: 1499
|
||||
}]
|
||||
}]
|
||||
};
|
||||
|
@ -136,7 +115,6 @@ function test_createRecord() {
|
|||
}
|
||||
|
||||
function run_test() {
|
||||
test_lastUsed();
|
||||
test_create();
|
||||
test_getAllTabs();
|
||||
test_createRecord();
|
||||
|
|
|
@ -34,18 +34,6 @@ function fakeSvcWinMediator() {
|
|||
return logs;
|
||||
}
|
||||
|
||||
function fakeSvcSession() {
|
||||
// actions on Session are captured in logs
|
||||
let logs = [];
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
setTabValue: function(target, prop, value) {
|
||||
logs.push({target: target, prop: prop, value: value});
|
||||
}
|
||||
};
|
||||
return logs;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
let engine = Service.engineManager.get("tabs");
|
||||
|
||||
|
@ -88,8 +76,6 @@ function run_test() {
|
|||
}
|
||||
|
||||
_("Test tab listener");
|
||||
logs = fakeSvcSession();
|
||||
let idx = 0;
|
||||
for each (let evttype in ["TabOpen", "TabClose", "TabSelect"]) {
|
||||
// Pretend we just synced.
|
||||
tracker.clearChangedIDs();
|
||||
|
@ -100,11 +86,6 @@ function run_test() {
|
|||
do_check_true(tracker.modified);
|
||||
do_check_true(Utils.deepEquals(Object.keys(engine.getChangedIDs()),
|
||||
[clientsEngine.localID]));
|
||||
do_check_eq(logs.length, idx+1);
|
||||
do_check_eq(logs[idx].target, evttype);
|
||||
do_check_eq(logs[idx].prop, "weaveLastUsed");
|
||||
do_check_true(typeof logs[idx].value == "number");
|
||||
idx++;
|
||||
}
|
||||
|
||||
// Pretend we just synced.
|
||||
|
@ -114,5 +95,4 @@ function run_test() {
|
|||
tracker.onTab({type: "pageshow", originalTarget: "pageshow"});
|
||||
do_check_true(Utils.deepEquals(Object.keys(engine.getChangedIDs()),
|
||||
[clientsEngine.localID]));
|
||||
do_check_eq(logs.length, idx); // test that setTabValue isn't called
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче