diff options
Diffstat (limited to 'browser/components/newtab/tests/xpcshell/test_NewTabPrefsProvider.js')
-rw-r--r-- | browser/components/newtab/tests/xpcshell/test_NewTabPrefsProvider.js | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/browser/components/newtab/tests/xpcshell/test_NewTabPrefsProvider.js b/browser/components/newtab/tests/xpcshell/test_NewTabPrefsProvider.js deleted file mode 100644 index f364d0300..000000000 --- a/browser/components/newtab/tests/xpcshell/test_NewTabPrefsProvider.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -/* global XPCOMUtils, equal, Preferences, NewTabPrefsProvider, run_next_test */ -/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ - -const Cu = Components.utils; -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Preferences.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider", - "resource:///modules/NewTabPrefsProvider.jsm"); - -function run_test() { - run_next_test(); -} - -add_task(function* test_observe() { - let prefsMap = NewTabPrefsProvider.prefs.prefsMap; - for (let prefName of prefsMap.keys()) { - let prefValueType = prefsMap.get(prefName); - - let beforeVal; - let afterVal; - - switch (prefValueType) { - case "bool": - beforeVal = false; - afterVal = true; - Preferences.set(prefName, beforeVal); - break; - case "localized": - case "str": - beforeVal = ""; - afterVal = "someStr"; - Preferences.set(prefName, beforeVal); - break; - } - NewTabPrefsProvider.prefs.init(); - let promise = new Promise(resolve => { - NewTabPrefsProvider.prefs.once(prefName, (name, data) => { // jshint ignore:line - resolve([name, data]); - }); - }); - Preferences.set(prefName, afterVal); - let [actualName, actualData] = yield promise; - equal(prefName, actualName, `emitter sent the correct pref: ${prefName}`); - equal(afterVal, actualData, `emitter collected correct pref data for ${prefName}`); - NewTabPrefsProvider.prefs.uninit(); - } -}); |