Bug 614224 - Try to use waitForAsyncUpdates in test_removeVisitsByTimeframe.js

a=tests-only
This commit is contained in:
Marco Bonardo 2010-11-24 10:44:05 +01:00
parent 300ff79a94
commit f05a93f655

View File

@ -58,8 +58,7 @@ var gTests = [
false, false,
0); 0);
} }
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, waitForAsyncUpdates(this.continue_run, this);
this.continue_run, this);
}, },
continue_run: function () { continue_run: function () {
print("Remove visits using timerange outside the URI's visits."); print("Remove visits using timerange outside the URI's visits.");
@ -87,9 +86,11 @@ var gTests = [
do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2). do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2).
isVisited(TEST_URI)); isVisited(TEST_URI));
print("Frecency should be unchanged."); waitForAsyncUpdates(function () {
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, print("Frecency should be positive.")
run_next_test, Components.utils.getGlobalForObject(this)); do_check_true(frecencyForUrl(TEST_URI) > 0);
run_next_test();
});
} }
}, },
@ -112,8 +113,7 @@ var gTests = [
bmsvc.DEFAULT_INDEX, bmsvc.DEFAULT_INDEX,
"bookmark title"); "bookmark title");
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, waitForAsyncUpdates(this.continue_run, this);
this.continue_run, this);
}, },
continue_run: function () { continue_run: function () {
print("Remove visits using timerange outside the URI's visits."); print("Remove visits using timerange outside the URI's visits.");
@ -141,9 +141,11 @@ var gTests = [
do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2). do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2).
isVisited(TEST_URI)); isVisited(TEST_URI));
print("Frecency should be unchanged."); waitForAsyncUpdates(function () {
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, print("Frecency should be positive.")
run_next_test, Components.utils.getGlobalForObject(this)); do_check_true(frecencyForUrl(TEST_URI) > 0);
run_next_test();
});
} }
}, },
@ -159,8 +161,7 @@ var gTests = [
false, false,
0); 0);
} }
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, waitForAsyncUpdates(this.continue_run, this);
this.continue_run, this);
}, },
continue_run: function () { continue_run: function () {
print("Remove the 5 most recent visits."); print("Remove the 5 most recent visits.");
@ -189,9 +190,11 @@ var gTests = [
do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2). do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2).
isVisited(TEST_URI)); isVisited(TEST_URI));
print("Frecency should be unchanged."); waitForAsyncUpdates(function () {
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, print("Frecency should be positive.")
run_next_test, Components.utils.getGlobalForObject(this)); do_check_true(frecencyForUrl(TEST_URI) > 0);
run_next_test();
});
} }
}, },
@ -213,8 +216,7 @@ var gTests = [
TEST_URI, TEST_URI,
bmsvc.DEFAULT_INDEX, bmsvc.DEFAULT_INDEX,
"bookmark title"); "bookmark title");
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, waitForAsyncUpdates(this.continue_run, this);
this.continue_run, this);
}, },
continue_run: function () { continue_run: function () {
print("Remove the 5 most recent visits."); print("Remove the 5 most recent visits.");
@ -243,9 +245,11 @@ var gTests = [
do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2). do_check_true(histsvc.QueryInterface(Ci.nsIGlobalHistory2).
isVisited(TEST_URI)); isVisited(TEST_URI));
print("Frecency should be unchanged."); waitForAsyncUpdates(function () {
waitForFrecency(TEST_URL, function (aFrecency) aFrecency > 0, print("Frecency should be positive.")
run_next_test, Components.utils.getGlobalForObject(this)); do_check_true(frecencyForUrl(TEST_URI) > 0);
run_next_test();
});
} }
}, },
@ -320,9 +324,11 @@ var gTests = [
do_check_false(histsvc.QueryInterface(Ci.nsIGlobalHistory2). do_check_false(histsvc.QueryInterface(Ci.nsIGlobalHistory2).
isVisited(PLACE_URI)); isVisited(PLACE_URI));
print("Frecency should be 0."); waitForAsyncUpdates(function () {
waitForFrecency(PLACE_URL, function (aFrecency) aFrecency == 0, print("Frecency should be zero.")
run_next_test, Components.utils.getGlobalForObject(this)); do_check_eq(frecencyForUrl(PLACE_URL), 0);
run_next_test();
});
} }
}, },
@ -369,9 +375,11 @@ var gTests = [
print("nsINavBookmarksService.isBookmarked should return true."); print("nsINavBookmarksService.isBookmarked should return true.");
do_check_true(bmsvc.isBookmarked(TEST_URI)); do_check_true(bmsvc.isBookmarked(TEST_URI));
print("Frecency should be -visit_count == -10."); waitForAsyncUpdates(function () {
waitForFrecency(TEST_URL, function (aFrecency) aFrecency == -10, print("Frecency should be -visit_count.")
run_next_test, Components.utils.getGlobalForObject(this)); do_check_eq(frecencyForUrl(TEST_URI), -10);
run_next_test();
});
} }
} }
]; ];