diff options
Diffstat (limited to 'dom/settings/tests')
-rw-r--r-- | dom/settings/tests/chrome.ini | 6 | ||||
-rw-r--r-- | dom/settings/tests/test_settings_service.js | 138 | ||||
-rw-r--r-- | dom/settings/tests/test_settings_service.xul | 19 | ||||
-rw-r--r-- | dom/settings/tests/test_settings_service_callback.js | 47 | ||||
-rw-r--r-- | dom/settings/tests/test_settings_service_callback.xul | 19 |
5 files changed, 0 insertions, 229 deletions
diff --git a/dom/settings/tests/chrome.ini b/dom/settings/tests/chrome.ini index 92b1554a0..5b0db9e40 100644 --- a/dom/settings/tests/chrome.ini +++ b/dom/settings/tests/chrome.ini @@ -4,13 +4,7 @@ support-files = file_loadserver.js file_bug1110872.js file_bug1110872.html - test_settings_service.js - test_settings_service_callback.js -[test_settings_service.xul] -run-if = buildapp == 'b2g' || buildapp == 'mulet' -[test_settings_service_callback.xul] -run-if = buildapp == 'b2g' || buildapp == 'mulet' [test_settings_basics.html] [test_settings_permissions.html] [test_settings_blobs.html] diff --git a/dom/settings/tests/test_settings_service.js b/dom/settings/tests/test_settings_service.js deleted file mode 100644 index 132877a5d..000000000 --- a/dom/settings/tests/test_settings_service.js +++ /dev/null @@ -1,138 +0,0 @@ -"use strict"; - -var Cu = Components.utils; -var Cc = Components.classes; -var Ci = Components.interfaces; - -if (SpecialPowers.isMainProcess()) { - SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm"); -} - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -SimpleTest.waitForExplicitFinish(); - -XPCOMUtils.defineLazyServiceGetter(this, "SettingsService", - "@mozilla.org/settingsService;1", - "nsISettingsService"); - -var tests = [ - /* Callback tests */ - function() { - let callbackCount = 10; - - let callback = { - handle: function(name, result) { - switch (callbackCount) { - case 10: - case 9: - is(result, true, "result is true"); - break; - case 8: - case 7: - is(result, false, "result is false"); - break; - case 6: - case 5: - is(result, 9, "result is 9"); - break; - case 4: - case 3: - is(result, 9.4, "result is 9.4"); - break; - case 2: - is(result, false, "result is false"); - break; - case 1: - is(result, null, "result is null"); - break; - default: - ok(false, "Unexpected call: " + callbackCount); - } - - --callbackCount; - if (callbackCount === 0) { - next(); - } - }, - - handleError: function(name) { - ok(false, "error: " + name); - } - }; - - let lock = SettingsService.createLock(); - let lock1 = SettingsService.createLock(); - - lock.set("asdf", true, callback, null); - lock1.get("asdf", callback); - lock.get("asdf", callback); - lock.set("asdf", false, callback, null); - lock.get("asdf", callback); - lock.set("int", 9, callback, null); - lock.get("int", callback); - lock.set("doub", 9.4, callback, null); - lock.get("doub", callback); - lock1.get("asdfxxx", callback); - }, - - /* Observer tests */ - function() { - const MOZSETTINGS_CHANGED = "mozsettings-changed"; - const TEST_OBSERVER_KEY = "test.observer.key"; - const TEST_OBSERVER_VALUE = true; - const TEST_OBSERVER_MESSAGE = "test.observer.message"; - - var obs = { - observe: function (subject, topic, data) { - - if (topic !== MOZSETTINGS_CHANGED) { - ok(false, "Event is not mozsettings-changed."); - return; - } - // Data is now stored in subject - if ("wrappedJSObject" in subject) { - ok(true, "JS object wrapped into subject"); - subject = subject.wrappedJSObject; - } - if (subject["key"] != TEST_OBSERVER_KEY) { - return; - } - - function checkProp(name, type, value) { - ok(name in subject, "subject." + name + " is present"); - is(typeof subject[name], type, "subject." + name + " is " + type); - is(subject[name], value, "subject." + name + " is " + value); - } - - checkProp("key", "string", TEST_OBSERVER_KEY); - checkProp("value", "boolean", TEST_OBSERVER_VALUE); - checkProp("isInternalChange", "boolean", true); - - Services.obs.removeObserver(this, MOZSETTINGS_CHANGED); - next(); - } - }; - - Services.obs.addObserver(obs, MOZSETTINGS_CHANGED, false); - - let lock = SettingsService.createLock(); - lock.set(TEST_OBSERVER_KEY, TEST_OBSERVER_VALUE, null); - } -]; - -function next() { - let step = tests.shift(); - if (step) { - try { - step(); - } catch(e) { - ok(false, "Test threw: " + e); - } - } else { - SimpleTest.finish(); - } -} - -next(); diff --git a/dom/settings/tests/test_settings_service.xul b/dom/settings/tests/test_settings_service.xul deleted file mode 100644 index 58a9efad9..000000000 --- a/dom/settings/tests/test_settings_service.xul +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<?xml-stylesheet type="text/css" href="chrome://global/skin"?> -<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=678695 ---> -<window title="Mozilla Bug 678695" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - <script type="application/javascript" - src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - - <!-- test results are displayed in the html:body --> - <body xmlns="http://www.w3.org/1999/xhtml"> - <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=678695" - target="_blank">Mozilla Bug 678695</a> - </body> - - <script type="application/javascript;version=1.7" src="test_settings_service.js" /> -</window> diff --git a/dom/settings/tests/test_settings_service_callback.js b/dom/settings/tests/test_settings_service_callback.js deleted file mode 100644 index a780bb9c3..000000000 --- a/dom/settings/tests/test_settings_service_callback.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -var Cu = Components.utils; -var Cc = Components.classes; -var Ci = Components.interfaces; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); - -SimpleTest.waitForExplicitFinish(); - -XPCOMUtils.defineLazyServiceGetter(this, "SettingsService", - "@mozilla.org/settingsService;1", - "nsISettingsService"); - -var tests = [ - function () { - let callback = { - handle: function() { - ok(true, "handle called!"); - next(); - }, - - handleAbort: function(name) { - ok(false, "error: " + name); - next(); - } - } - let lock = SettingsService.createLock(callback); - lock.set("xasdf", true, null, null); - } -]; - -function next() { - let step = tests.shift(); - if (step) { - try { - step(); - } catch(e) { - ok(false, "Test threw: " + e); - } - } else { - SimpleTest.finish(); - } -} - -next(); diff --git a/dom/settings/tests/test_settings_service_callback.xul b/dom/settings/tests/test_settings_service_callback.xul deleted file mode 100644 index 3e4d27751..000000000 --- a/dom/settings/tests/test_settings_service_callback.xul +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<?xml-stylesheet type="text/css" href="chrome://global/skin"?> -<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1012214 ---> -<window title="Mozilla Bug 1012214" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - <script type="application/javascript" - src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - - <!-- test results are displayed in the html:body --> - <body xmlns="http://www.w3.org/1999/xhtml"> - <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1012214" - target="_blank">Mozilla Bug 1012214</a> - </body> - - <script type="application/javascript;version=1.7" src="test_settings_service_callback.js" /> -</window> |