1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 openFromNormalShouldOpenInNormal();
8 function openFromNormalShouldOpenInNormal() {
9 nextTest = openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser;
10 chrome.windows.getAll({populate: true}, function(windows) {
11 chrome.test.assertEq(1, windows.length);
12 chrome.test.assertFalse(windows[0].incognito);
13 chrome.test.assertEq(1, windows[0].tabs.length);
14 chrome.test.assertFalse(windows[0].tabs[0].incognito);
16 chrome.windows.update(windows[0].id, {
19 chrome.browserAction.openPopup(function(popupWindow) {
20 chrome.test.assertTrue(!!popupWindow);
21 // The rest of the test continues in popup.html.
27 function openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser() {
29 chrome.windows.getCurrent(function(normalWin) {
30 chrome.test.assertFalse(normalWin.incognito);
31 // Create an incognito window.
32 chrome.windows.create({
35 }, function(incognitoWin) {
36 // Remove the normal window. We keep running because of the incognito
38 chrome.windows.remove(normalWin.id, function() {
39 chrome.tabs.getAllInWindow(incognitoWin.id, function(tabs) {
40 chrome.test.assertEq(1, tabs.length);
41 chrome.browserAction.openPopup(function(popupWindow) {
42 chrome.test.assertTrue(!!popupWindow);
43 // The rest of the test continues in popup.html.
51 function verifyCreatedTab(tab) {
52 // The new tab should be a normal tab, and it should be in a normal
54 chrome.test.assertFalse(tab.incognito);
55 chrome.windows.get(tab.windowId, function(win) {
56 chrome.test.assertFalse(win.incognito);
60 chrome.test.notifyPass();