Bug 1332269 - fix permafailure on aurora in browser_theme.js by not implicitly depending on the default value of devtools.theme, r=ochameau

MozReview-Commit-ID: 3n4bfqeM5IK

--HG--
extra : rebase_source : a409db891bdcb5e3fbfb37938cc5d989b2d2247c
This commit is contained in:
Gijs Kruitbosch 2017-01-19 13:58:45 +00:00
Родитель 5d0a680586
Коммит 6c3d16a720
1 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -32,21 +32,24 @@ function testGetTheme() {
function testSetTheme() {
let originalTheme = getTheme();
// Put this in a variable rather than hardcoding it because the default
// changes between aurora and nightly
let otherTheme = originalTheme == "dark" ? "light" : "dark";
let prefObserver = new PrefObserver("devtools.");
prefObserver.once("devtools.theme", pref => {
is(pref, "devtools.theme",
"A preference event triggered by setTheme has correct pref.");
let newValue = Services.prefs.getCharPref("devtools.theme");
is(newValue, "dark",
is(newValue, otherTheme,
"A preference event triggered by setTheme comes after the value is set.");
});
setTheme("dark");
is(Services.prefs.getCharPref("devtools.theme"), "dark",
"setTheme() correctly sets dark theme.");
setTheme("light");
is(Services.prefs.getCharPref("devtools.theme"), "light",
"setTheme() correctly sets light theme.");
setTheme(otherTheme);
is(Services.prefs.getCharPref("devtools.theme"), otherTheme,
"setTheme() correctly sets another theme.");
setTheme(originalTheme);
is(Services.prefs.getCharPref("devtools.theme"), originalTheme,
"setTheme() correctly sets the original theme.");
setTheme("firebug");
is(Services.prefs.getCharPref("devtools.theme"), "firebug",
"setTheme() correctly sets firebug theme.");