gecko-dev/browser/components/loop/test/mochitest/browser_mozLoop_prefs.js
Mark Banner 5d23c803c5 Bug 1022594 Part 1a Add a getLoopBoolPref function to the MozLoopAPI. r=mikedeboer
--HG--
rename : browser/components/loop/test/mochitest/browser_mozLoop_charPref.js => browser/components/loop/test/mochitest/browser_mozLoop_prefs.js
rename : browser/components/loop/test/xpcshell/test_loopservice_get_loop_char_pref.js => browser/components/loop/test/xpcshell/test_loopservice_loop_prefs.js
2014-08-15 13:33:51 +01:00

40 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* This is an integration test from navigator.mozLoop through to the end
* effects - rather than just testing MozLoopAPI alone.
*/
add_task(loadLoopPanel);
add_task(function* test_mozLoop_charPref() {
registerCleanupFunction(function () {
Services.prefs.clearUserPref("loop.test");
});
Assert.ok(gMozLoopAPI, "mozLoop should exist");
// Test setLoopCharPref
gMozLoopAPI.setLoopCharPref("test", "foo");
Assert.equal(Services.prefs.getCharPref("loop.test"), "foo",
"should set loop pref value correctly");
// Test getLoopCharPref
Assert.equal(gMozLoopAPI.getLoopCharPref("test"), "foo",
"should get loop pref value correctly");
});
add_task(function* test_mozLoop_boolPref() {
registerCleanupFunction(function () {
Services.prefs.clearUserPref("loop.testBool");
});
Assert.ok(gMozLoopAPI, "mozLoop should exist");
Services.prefs.setBoolPref("loop.testBool", true);
// Test getLoopCharPref
Assert.equal(gMozLoopAPI.getLoopBoolPref("testBool"), true,
"should get loop pref value correctly");
});