Bug 856043 - Test that the Restore Previous Session menu item is not displayed in private mode. r=ehsan

This commit is contained in:
Ioana Budnar 2013-05-07 15:10:00 +03:00
parent 73a360f64e
commit b2ebd7b3f2
2 changed files with 35 additions and 0 deletions

View File

@ -34,6 +34,7 @@ MOCHITEST_BROWSER_FILES = \
browser_privatebrowsing_localStorage_page1.html \
browser_privatebrowsing_localStorage_page2.html \
browser_privatebrowsing_nonbrowser.js \
browser_privatebrowsing_noSessionRestoreMenuOption.js \
browser_privatebrowsing_opendir.js \
browser_privatebrowsing_openlocation.js \
browser_privatebrowsing_openLocationLastURL.js \

View File

@ -0,0 +1,34 @@
/* 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 checks that the Session Restore menu option is not enabled in private mode
function test() {
waitForExplicitFinish();
function testNoSessionRestoreMenuItem() {
let win = OpenBrowserWindow({private: true});
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
ok(true, "The second private window got loaded");
let srCommand = win.document.getElementById("Browser:RestoreLastSession");
ok(srCommand, "The Session Restore command should exist");
is(PrivateBrowsingUtils.isWindowPrivate(win), true,
"PrivateBrowsingUtils should report the correct per-window private browsing status");
is(srCommand.hasAttribute("disabled"), true,
"The Session Restore command should be disabled in private browsing mode");
win.close();
finish();
}, false);
}
let win = OpenBrowserWindow({private: true});
win.addEventListener("load", function onload() {
win.removeEventListener("load", onload, false);
ok(true, "The first private window got loaded");
win.gBrowser.addTab("about:mozilla");
win.close();
testNoSessionRestoreMenuItem();
}, false);
}