1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/metro/base/tests/mochitest/browser_private_browsing.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +"use strict"; 1.10 + 1.11 +function test() { 1.12 + runTests(); 1.13 +} 1.14 + 1.15 +gTests.push({ 1.16 + desc: "Private tab sanity check", 1.17 + run: function() { 1.18 + let tab = Browser.addTab("about:mozilla"); 1.19 + is(tab.isPrivate, false, "Tabs are not private by default"); 1.20 + is(tab.chromeTab.hasAttribute("private"), false, 1.21 + "non-private tab has no private attribute"); 1.22 + 1.23 + let child = Browser.addTab("about:mozilla", false, tab); 1.24 + is(child.isPrivate, false, "Child of a non-private tab is not private"); 1.25 + 1.26 + Browser.closeTab(child, { forceClose: true }); 1.27 + Browser.closeTab(tab, { forceClose: true }); 1.28 + 1.29 + tab = Browser.addTab("about:mozilla", false, null, { private: true }); 1.30 + is(tab.isPrivate, true, "Create a private tab"); 1.31 + is(tab.chromeTab.getAttribute("private"), "true", 1.32 + "private tab has private attribute"); 1.33 + 1.34 + child = Browser.addTab("about:mozilla", false, tab); 1.35 + is(child.isPrivate, true, "Child of a private tab is private"); 1.36 + 1.37 + Browser.closeTab(child, { forceClose: true }); 1.38 + Browser.closeTab(tab, { forceClose: true }); 1.39 + } 1.40 +});