зеркало из https://github.com/mozilla/pjs.git
Bug 589905 - Remote preferences test cases. r=dwitte, a=blocking-fennec
--HG-- extra : rebase_source : 54bf57ab0fadd2adf7b4b5cacbde8be3c6260e61
This commit is contained in:
Родитель
5cde12d946
Коммит
628d890ec6
|
@ -48,4 +48,11 @@ MODULE = test_libpref
|
|||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
ifdef MOZ_IPC
|
||||
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
XPCSHELL_TESTS += unit_ipc
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
|
||||
function isParentProcess() {
|
||||
let appInfo = Cc["@mozilla.org/xre/app-info;1"];
|
||||
return (!appInfo || appInfo.getService(Ci.nsIXULRuntime).processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT);
|
||||
}
|
||||
|
||||
function verify_existing_prefs() {
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
||||
do_check_eq(pb.getBoolPref("Test.IPC.bool"), true);
|
||||
do_check_eq(pb.getIntPref("Test.IPC.int"), 23);
|
||||
do_check_eq(pb.getCharPref("Test.IPC.char"), "hey");
|
||||
do_test_finished();
|
||||
_do_main();
|
||||
}
|
||||
|
||||
function verify_observed_prefs() {
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
||||
do_test_pending();
|
||||
do_check_eq(pb.getBoolPref("Test.IPC.bool.new"), true);
|
||||
do_check_eq(pb.getIntPref("Test.IPC.int.new"), 23);
|
||||
do_check_eq(pb.getCharPref("Test.IPC.char.new"), "hey");
|
||||
do_test_finished();
|
||||
_do_main();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
if (isParentProcess()) {
|
||||
var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
||||
pb.setBoolPref("Test.IPC.bool", true);
|
||||
pb.setIntPref("Test.IPC.int", 23);
|
||||
pb.setCharPref("Test.IPC.char", "hey");
|
||||
|
||||
do_load_child_test_harness();
|
||||
|
||||
do_test_pending();
|
||||
sendCommand(verify_existing_prefs.toString(), do_test_finished);
|
||||
|
||||
// these prefs are set after the child has been created.
|
||||
pb.setBoolPref("Test.IPC.bool.new", true);
|
||||
pb.setIntPref("Test.IPC.int.new", 23);
|
||||
pb.setCharPref("Test.IPC.char.new", "hey");
|
||||
|
||||
do_test_pending();
|
||||
sendCommand(verify_existing_prefs.toString(), do_test_finished);
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче