diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-06-26 16:09:08 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-06-26 16:09:08 -0400 |
commit | eda567b364a06e9e63efb865a6b1c73f1cb5232e (patch) | |
tree | 912ab15d877f733318e2c0394713bca33b830547 /toolkit/mozapps/webextensions/test/xpcshell/test_bug620837.js | |
parent | 80eb356d57fc310cdf812cae63de30d6e56c1788 (diff) | |
download | UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.gz UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.lz UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.xz UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.zip |
[AllAM] Remove Mozilla Tests
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_bug620837.js')
-rw-r--r-- | toolkit/mozapps/webextensions/test/xpcshell/test_bug620837.js | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_bug620837.js b/toolkit/mozapps/webextensions/test/xpcshell/test_bug620837.js deleted file mode 100644 index 6bfbfcaf2..000000000 --- a/toolkit/mozapps/webextensions/test/xpcshell/test_bug620837.js +++ /dev/null @@ -1,145 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -Components.utils.import("resource://testing-common/httpd.js"); - -const PREF_BLOCKLIST_LASTUPDATETIME = "app.update.lastUpdateTime.blocklist-background-update-timer"; -const PREF_BLOCKLIST_PINGCOUNTTOTAL = "extensions.blocklist.pingCountTotal"; -const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion"; - -const SECONDS_IN_DAY = 60 * 60 * 24; - -var gExpectedQueryString = null; -var gNextTest = null; -var gTestserver = null; - -function notify_blocklist() { - var blocklist = AM_Cc["@mozilla.org/extensions/blocklist;1"]. - getService(AM_Ci.nsITimerCallback); - blocklist.notify(null); -} - -function pathHandler(metadata, response) { - do_check_eq(metadata.queryString, gExpectedQueryString); - gNextTest(); -} - -function run_test() { - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); - - gTestserver = new HttpServer(); - gTestserver.registerPathHandler("/", pathHandler); - gTestserver.start(-1); - gPort = gTestserver.identity.primaryPort; - - Services.prefs.setCharPref("extensions.blocklist.url", - "http://localhost:" + gPort + - "/?%PING_COUNT%&%TOTAL_PING_COUNT%&%DAYS_SINCE_LAST_PING%"); - - do_test_pending(); - test1(); -} - -function getNowInSeconds() { - return Math.round(Date.now() / 1000); -} - -function test1() { - gNextTest = test2; - gExpectedQueryString = "1&1&new"; - notify_blocklist(); -} - -function test2() { - gNextTest = test3; - gExpectedQueryString = "invalid&invalid&invalid"; - notify_blocklist(); -} - -function test3() { - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - SECONDS_IN_DAY)); - gNextTest = test4; - gExpectedQueryString = "2&2&1"; - notify_blocklist(); -} - -function test4() { - Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, -1); - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 2))); - gNextTest = test5; - gExpectedQueryString = "1&3&2"; - notify_blocklist(); -} - -function test5() { - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, getNowInSeconds()); - gNextTest = test6; - gExpectedQueryString = "invalid&invalid&0"; - notify_blocklist(); -} - -function test6() { - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 3))); - gNextTest = test7; - gExpectedQueryString = "2&4&3"; - notify_blocklist(); -} - -function test7() { - Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, 2147483647); - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 4))); - gNextTest = test8; - gExpectedQueryString = "2147483647&5&4"; - notify_blocklist(); -} - -function test8() { - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 5))); - gNextTest = test9; - gExpectedQueryString = "1&6&5"; - notify_blocklist(); -} - -function test9() { - Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTTOTAL, 2147483647); - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 6))); - gNextTest = test10; - gExpectedQueryString = "2&2147483647&6"; - notify_blocklist(); -} - -function test10() { - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 7))); - gNextTest = test11; - gExpectedQueryString = "3&1&7"; - notify_blocklist(); -} - -function test11() { - Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, -1); - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 8))); - gNextTest = test12; - gExpectedQueryString = "1&2&8"; - notify_blocklist(); -} - -function test12() { - Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, - (getNowInSeconds() - (SECONDS_IN_DAY * 9))); - gNextTest = finish; - gExpectedQueryString = "2&3&9"; - notify_blocklist(); -} - -function finish() { - gTestserver.stop(do_test_finished); -} |