mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 540751 - test_update_frecency_after_delete.js should wait for clear history. a=dietrich
This commit is contained in:
parent
451974f290
commit
cd4145881c
@ -83,6 +83,7 @@ tests.push({
|
|||||||
|
|
||||||
// URI's only "bookmark" is now unvisited livemark item => frecency = 0.
|
// URI's only "bookmark" is now unvisited livemark item => frecency = 0.
|
||||||
do_check_eq(getFrecency(lmItemURL), 0);
|
do_check_eq(getFrecency(lmItemURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ tests.push({
|
|||||||
|
|
||||||
// URI's only "bookmark" is now *visited* livemark item => frecency != 0.
|
// URI's only "bookmark" is now *visited* livemark item => frecency != 0.
|
||||||
do_check_neq(getFrecency(lmItemURL), 0);
|
do_check_neq(getFrecency(lmItemURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -128,6 +130,7 @@ tests.push({
|
|||||||
|
|
||||||
// Unvisited URI no longer bookmarked => frecency should = 0.
|
// Unvisited URI no longer bookmarked => frecency should = 0.
|
||||||
do_check_eq(getFrecency(url), 0);
|
do_check_eq(getFrecency(url), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -151,6 +154,7 @@ tests.push({
|
|||||||
|
|
||||||
// *Visited* URI no longer bookmarked => frecency should != 0.
|
// *Visited* URI no longer bookmarked => frecency should != 0.
|
||||||
do_check_neq(getFrecency(bmURL), 0);
|
do_check_neq(getFrecency(bmURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -178,6 +182,7 @@ tests.push({
|
|||||||
|
|
||||||
// URI still bookmarked => frecency should != 0.
|
// URI still bookmarked => frecency should != 0.
|
||||||
do_check_neq(getFrecency(bmURL), 0);
|
do_check_neq(getFrecency(bmURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -204,6 +209,7 @@ tests.push({
|
|||||||
|
|
||||||
// URI's only "bookmark" is now unvisited livemark item => frecency = 0.
|
// URI's only "bookmark" is now unvisited livemark item => frecency = 0.
|
||||||
do_check_eq(getFrecency(lmItemURL), 0);
|
do_check_eq(getFrecency(lmItemURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -230,6 +236,7 @@ tests.push({
|
|||||||
|
|
||||||
// URI's only "bookmark" is now *visited* livemark item => frecency != 0.
|
// URI's only "bookmark" is now *visited* livemark item => frecency != 0.
|
||||||
do_check_neq(getFrecency(lmItemURL), 0);
|
do_check_neq(getFrecency(lmItemURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -251,6 +258,7 @@ tests.push({
|
|||||||
|
|
||||||
// Unvisited URI no longer bookmarked => frecency should = 0.
|
// Unvisited URI no longer bookmarked => frecency should = 0.
|
||||||
do_check_eq(getFrecency(url), 0);
|
do_check_eq(getFrecency(url), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -274,6 +282,7 @@ tests.push({
|
|||||||
|
|
||||||
// *Visited* URI no longer bookmarked => frecency should != 0.
|
// *Visited* URI no longer bookmarked => frecency should != 0.
|
||||||
do_check_neq(getFrecency(bmURL), 0);
|
do_check_neq(getFrecency(bmURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -302,6 +311,7 @@ tests.push({
|
|||||||
|
|
||||||
// URI still bookmarked => frecency should != 0.
|
// URI still bookmarked => frecency should != 0.
|
||||||
do_check_neq(getFrecency(bmURL), 0);
|
do_check_neq(getFrecency(bmURL), 0);
|
||||||
|
runNextTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -346,21 +356,6 @@ function getFrecency(aURL) {
|
|||||||
return frecency;
|
return frecency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverts the Places database to initial state in preparation for the next test. Also
|
|
||||||
* prints out some info about the next test.
|
|
||||||
*
|
|
||||||
* @param aTestIndex
|
|
||||||
* the index in tests of the test to prepare
|
|
||||||
* @param aTestName
|
|
||||||
* a description of the test to prepare
|
|
||||||
*/
|
|
||||||
function prepTest(aTestIndex, aTestName) {
|
|
||||||
print("Test " + aTestIndex + ": " + aTestName);
|
|
||||||
histServ.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
|
||||||
remove_all_bookmarks();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a visit for aURI.
|
* Adds a visit for aURI.
|
||||||
*
|
*
|
||||||
@ -374,14 +369,23 @@ function visit(aURI) {
|
|||||||
histServ.TRANSITION_BOOKMARK,
|
histServ.TRANSITION_BOOKMARK,
|
||||||
false,
|
false,
|
||||||
0);
|
0);
|
||||||
do_check_true(visitId > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
for (let i= 0; i < tests.length; i++) {
|
do_test_pending();
|
||||||
prepTest(i, tests[i].desc);
|
runNextTest();
|
||||||
tests[i].run();
|
}
|
||||||
|
|
||||||
|
function runNextTest() {
|
||||||
|
if (tests.length) {
|
||||||
|
let test = tests.shift();
|
||||||
|
print("Test " + + ": " + test.desc);
|
||||||
|
remove_all_bookmarks();
|
||||||
|
waitForClearHistory(test.run);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
do_test_finished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user