Bug 806698 - Port browser_privatebrowsing_theming.js to the new per-window PB APIs; r=jdm

--HG--
rename : browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_theming.js => browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_theming.js
This commit is contained in:
Ehsan Akhgari 2012-11-08 15:32:24 -05:00
parent 1c2b6fe0b3
commit a30f6c598a
2 changed files with 39 additions and 0 deletions

View File

@ -19,6 +19,7 @@ MOCHITEST_BROWSER_FILES = \
browser_privatebrowsing_crh.js \
browser_privatebrowsing_lastpbcontextexited.js \
browser_privatebrowsing_opendir.js \
browser_privatebrowsing_theming.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This test makes sure that privatebrowsingmode attribute of the window is correctly
// adjusted based on whether the window is a private window.
var windowsToClose = [];
function testOnWindow(options, callback) {
var win = OpenBrowserWindow(options);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
windowsToClose.push(win);
executeSoon(function() callback(win));
}, false);
}
registerCleanupFunction(function() {
windowsToClose.forEach(function(win) {
win.close();
});
});
function test() {
// initialization
waitForExplicitFinish();
ok(!document.documentElement.hasAttribute("privatebrowsingmode"),
"privatebrowsingmode should not be present in normal mode");
// open a private window
testOnWindow({private: true}, function(win) {
is(win.document.documentElement.getAttribute("privatebrowsingmode"), "temporary",
"privatebrowsingmode should be \"temporary\" inside the private browsing mode");
finish();
});
}