Bug 1416094 - Test
MozReview-Commit-ID: 8YoZwxiLWoH
--- a/toolkit/components/url-classifier/tests/mochitest/test_threathit_report.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_threathit_report.html
@@ -132,17 +132,17 @@ function checkResults(aTestdata, aExpect
let url = "http://" + SJS + "?" + params.toString();
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.send();
}
function waitForUpdate(data) {
- listmanager.checkForUpdates(data.updateUrl);
+ listmanager.forceUpdates(data.list);
return new Promise(resolve => {
Services.obs.addObserver(function observer(aSubject, aTopic) {
Services.obs.removeObserver(observer, aTopic);
resolve();
}, "safebrowsing-update-finished");
});
}
--- a/toolkit/components/url-classifier/tests/unit/test_hashcompleter_v4.js
+++ b/toolkit/components/url-classifier/tests/unit/test_hashcompleter_v4.js
@@ -1,19 +1,18 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
// These tables have a different update URL (for v4).
const TEST_TABLE_DATA_V4 = {
tableName: "test-phish-proto",
- providerName: "google4",
+ providerName: "test",
updateUrl: "http://localhost:5555/safebrowsing/update?",
gethashUrl: "http://localhost:5555/safebrowsing/gethash-v4?",
};
-const PREF_NEXTUPDATETIME_V4 = "browser.safebrowsing.provider.google4.nextupdatetime";
const GETHASH_PATH = "/safebrowsing/gethash-v4";
// The protobuf binary represention of gethash response:
// minimumWaitDuration : 12 secs 10 nanosecs
// negativeCacheDuration : 120 secs 9 nanosecs
//
// { CompleteHash, ThreatType, CacheDuration { secs, nanos } };
// { nsCString("01234567890123456789012345678901"), SOCIAL_ENGINEERING_PUBLIC, { 8, 500 } },
@@ -66,22 +65,22 @@ gListManager.registerTable(TEST_TABLE_DA
TEST_TABLE_DATA_V4.updateUrl,
TEST_TABLE_DATA_V4.gethashUrl);
// This is unfortunately needed since v4 gethash request
// requires the threat type (table name) as well as the
// state it's associated with. We have to run the update once
// to have the state written.
add_test(function test_update_v4() {
- gListManager.disableUpdate(TEST_TABLE_DATA_V4.tableName);
- gListManager.enableUpdate(TEST_TABLE_DATA_V4.tableName);
-
// Force table update.
- Services.prefs.setCharPref(PREF_NEXTUPDATETIME_V4, "1");
- gListManager.maybeToggleUpdateChecking();
+ gListManager.forceUpdates(TEST_TABLE_DATA_V4.tableName);
+ Services.obs.addObserver(function observer(aSubject, aTopic) {
+ Services.obs.removeObserver(observer, aTopic);
+ run_next_test();
+ }, "safebrowsing-update-finished");
});
add_test(function test_getHashRequestV4() {
let request = gUrlUtil.makeFindFullHashRequestV4([TEST_TABLE_DATA_V4.tableName],
[btoa(NEW_CLIENT_STATE)],
[btoa("0123"), btoa("1234567"), btoa("1111")].sort(),
1,
3);