OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 var nextTest = null; |
| 6 openFromNormalShouldOpenInNormal(); |
| 7 |
| 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); |
| 15 |
| 16 // The rest of the test continues in infobar.html. |
| 17 chrome.experimental.infobars.show({tabId: windows[0].tabs[0].id, |
| 18 path: "infobar.html"}); |
| 19 }); |
| 20 } |
| 21 |
| 22 function openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser() { |
| 23 nextTest = null; |
| 24 chrome.windows.getCurrent(function(normalWin) { |
| 25 chrome.test.assertFalse(normalWin.incognito); |
| 26 // Create an incognito window. |
| 27 chrome.windows.create({ incognito: true }, function(incognitoWin) { |
| 28 // Remove the normal window. We keep running because of the incognito |
| 29 // window. |
| 30 chrome.windows.remove(normalWin.id, function() { |
| 31 chrome.tabs.getAllInWindow(incognitoWin.id, function(tabs) { |
| 32 chrome.test.assertEq(1, tabs.length); |
| 33 // The rest of the test continues in infobar.html. |
| 34 chrome.experimental.infobars.show({tabId: tabs[0].id, |
| 35 path: "infobar.html"}); |
| 36 }); |
| 37 }); |
| 38 }); |
| 39 }); |
| 40 } |
| 41 |
| 42 function verifyCreatedTab(tab) { |
| 43 // The new tab should be a normal tab, and it should be in a normal |
| 44 // window. |
| 45 chrome.test.assertFalse(tab.incognito); |
| 46 chrome.windows.get(tab.windowId, function(win) { |
| 47 chrome.test.assertFalse(win.incognito); |
| 48 if (nextTest) { |
| 49 nextTest(); |
| 50 } else { |
| 51 chrome.test.notifyPass(); |
| 52 } |
| 53 }); |
| 54 } |
OLD | NEW |