Files
tenfourfox/browser/extensions/loop/chrome/test/xpcshell/test_loopapi_prefs.js
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

37 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { LoopAPI } = Cu.import("chrome://loop/content/modules/MozLoopAPI.jsm", {});
var [, gHandlers] = LoopAPI.inspect();
add_task(function* test_mozLoop_charPref() {
do_register_cleanup(function() {
Services.prefs.clearUserPref("loop.test");
});
// Test setLoopPref
gHandlers.SetLoopPref({ data: ["test", "foo", Ci.nsIPrefBranch.PREF_STRING] },
() => {});
Assert.equal(Services.prefs.getCharPref("loop.test"), "foo",
"should set loop pref value correctly");
// Test getLoopPref
gHandlers.GetLoopPref({ data: ["test"] }, result => {
Assert.equal(result, "foo", "should get loop pref value correctly");
});
});
add_task(function* test_mozLoop_boolPref() {
do_register_cleanup(function() {
Services.prefs.clearUserPref("loop.testBool");
});
Services.prefs.setBoolPref("loop.testBool", true);
// Test getLoopPref
gHandlers.GetLoopPref({ data: ["testBool"] }, result => {
Assert.equal(result, true, "should get loop pref value correctly");
});
});