From eda567b364a06e9e63efb865a6b1c73f1cb5232e Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Tue, 26 Jun 2018 16:09:08 -0400 Subject: [AllAM] Remove Mozilla Tests --- .../test/xpcshell/test_blocklist_gfx.js | 157 --------------------- 1 file changed, 157 deletions(-) delete mode 100644 toolkit/mozapps/webextensions/test/xpcshell/test_blocklist_gfx.js (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_blocklist_gfx.js') diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_blocklist_gfx.js b/toolkit/mozapps/webextensions/test/xpcshell/test_blocklist_gfx.js deleted file mode 100644 index cbcd5cb7e..000000000 --- a/toolkit/mozapps/webextensions/test/xpcshell/test_blocklist_gfx.js +++ /dev/null @@ -1,157 +0,0 @@ -const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -const TEST_APP_ID = "xpcshell@tests.mozilla.org"; - - -const EVENT_NAME = "blocklist-data-gfxItems"; - -const SAMPLE_GFX_RECORD = { - "driverVersionComparator": "LESS_THAN_OR_EQUAL", - "driverVersion": "8.17.12.5896", - "vendor": "0x10de", - "blockID": "g36", - "feature": "DIRECT3D_9_LAYERS", - "devices": ["0x0a6c", "geforce"], - "featureStatus": "BLOCKED_DRIVER_VERSION", - "last_modified": 1458035931837, - "os": "WINNT 6.1", - "id": "3f947f16-37c2-4e96-d356-78b26363729b", - "versionRange": {"minVersion": 0, "maxVersion": "*"} -}; - - -function Blocklist() { - let blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService().wrappedJSObject; - blocklist._clear(); - return blocklist; -} - - -function run_test() { - run_next_test(); -} - - -add_task(function* test_sends_serialized_data() { - const blocklist = Blocklist(); - blocklist._gfxEntries = [SAMPLE_GFX_RECORD]; - - const expected = "blockID:g36\tdevices:0x0a6c,geforce\tdriverVersion:8.17.12.5896\t" + - "driverVersionComparator:LESS_THAN_OR_EQUAL\tfeature:DIRECT3D_9_LAYERS\t" + - "featureStatus:BLOCKED_DRIVER_VERSION\tos:WINNT 6.1\tvendor:0x10de\t" + - "versionRange:0,*"; - let received; - const observe = (subject, topic, data) => { received = data }; - Services.obs.addObserver(observe, EVENT_NAME, false); - blocklist._notifyObserversBlocklistGFX(); - equal(received, expected); - Services.obs.removeObserver(observe, EVENT_NAME); -}); - - -add_task(function* test_parsing_fails_if_devices_contains_comma() { - const input = "" + - "" + - " " + - " " + - " 0x2,582" + - " 0x2782" + - " " + - " " + - "" + - ""; - const blocklist = Blocklist(); - blocklist._loadBlocklistFromString(input); - equal(blocklist._gfxEntries[0].devices.length, 1); - equal(blocklist._gfxEntries[0].devices[0], "0x2782"); -}); - - -add_task(function* test_empty_values_are_ignored() { - const input = "" + - "" + - " " + - " " + - " " + - "" + - ""; - const blocklist = Blocklist(); - let received; - const observe = (subject, topic, data) => { received = data }; - Services.obs.addObserver(observe, EVENT_NAME, false); - blocklist._loadBlocklistFromString(input); - ok(received.indexOf("os" < 0)); - Services.obs.removeObserver(observe, EVENT_NAME); -}); - -add_task(function* test_empty_devices_are_ignored() { - const input = "" + - "" + - " " + - " " + - " " + - "" + - ""; - const blocklist = Blocklist(); - let received; - const observe = (subject, topic, data) => { received = data }; - Services.obs.addObserver(observe, EVENT_NAME, false); - blocklist._loadBlocklistFromString(input); - ok(received.indexOf("devices" < 0)); - Services.obs.removeObserver(observe, EVENT_NAME); -}); - -add_task(function* test_version_range_default_values() { - const input = "" + - "" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - "" + - ""; - const blocklist = Blocklist(); - blocklist._loadBlocklistFromString(input); - equal(blocklist._gfxEntries[0].versionRange.minVersion, "13.0b2"); - equal(blocklist._gfxEntries[0].versionRange.maxVersion, "42.0"); - equal(blocklist._gfxEntries[1].versionRange.minVersion, "0"); - equal(blocklist._gfxEntries[1].versionRange.maxVersion, "2.0"); - equal(blocklist._gfxEntries[2].versionRange.minVersion, "1.0"); - equal(blocklist._gfxEntries[2].versionRange.maxVersion, "*"); - equal(blocklist._gfxEntries[3].versionRange.minVersion, "0"); - equal(blocklist._gfxEntries[3].versionRange.maxVersion, "*"); - equal(blocklist._gfxEntries[4].versionRange.minVersion, "0"); - equal(blocklist._gfxEntries[4].versionRange.maxVersion, "*"); -}); - -add_task(function* test_blockid_attribute() { - const input = "" + - "" + - " " + - " 0x10de " + - " " + - " " + - " DIRECT3D_9_LAYERS " + - " " + - "" + - ""; - const blocklist = Blocklist(); - blocklist._loadBlocklistFromString(input); - equal(blocklist._gfxEntries[0].blockID, "g60"); - ok(!blocklist._gfxEntries[1].hasOwnProperty("blockID")); -}); -- cgit v1.2.3