| OLD | NEW |
| 1 <script> | 1 <!-- |
| 2 var nextTest = null; | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
| 3 openFromNormalShouldOpenInNormal(); | 3 * source code is governed by a BSD-style license that can be found in the |
| 4 | 4 * LICENSE file. |
| 5 function openFromNormalShouldOpenInNormal() { | 5 --> |
| 6 nextTest = openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser; | 6 <script src="background.js"></script> |
| 7 chrome.windows.getAll({populate: true}, function(windows) { | |
| 8 chrome.test.assertEq(1, windows.length); | |
| 9 chrome.test.assertFalse(windows[0].incognito); | |
| 10 chrome.test.assertEq(1, windows[0].tabs.length); | |
| 11 chrome.test.assertFalse(windows[0].tabs[0].incognito); | |
| 12 | |
| 13 // The rest of the test continues in infobar.html. | |
| 14 chrome.experimental.infobars.show({tabId: windows[0].tabs[0].id, | |
| 15 path: "infobar.html"}); | |
| 16 }); | |
| 17 } | |
| 18 | |
| 19 function openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser() { | |
| 20 nextTest = null; | |
| 21 chrome.windows.getCurrent(function(normalWin) { | |
| 22 chrome.test.assertFalse(normalWin.incognito); | |
| 23 // Create an incognito window. | |
| 24 chrome.windows.create({ incognito: true }, function(incognitoWin) { | |
| 25 // Remove the normal window. We keep running because of the incognito | |
| 26 // window. | |
| 27 chrome.windows.remove(normalWin.id, function() { | |
| 28 chrome.tabs.getAllInWindow(incognitoWin.id, function(tabs) { | |
| 29 chrome.test.assertEq(1, tabs.length); | |
| 30 // The rest of the test continues in infobar.html. | |
| 31 chrome.experimental.infobars.show({tabId: tabs[0].id, | |
| 32 path: "infobar.html"}); | |
| 33 }); | |
| 34 }); | |
| 35 }); | |
| 36 }); | |
| 37 } | |
| 38 | |
| 39 function verifyCreatedTab(tab) { | |
| 40 // The new tab should be a normal tab, and it should be in a normal | |
| 41 // window. | |
| 42 chrome.test.assertFalse(tab.incognito); | |
| 43 chrome.windows.get(tab.windowId, function(win) { | |
| 44 chrome.test.assertFalse(win.incognito); | |
| 45 if (nextTest) { | |
| 46 nextTest(); | |
| 47 } else { | |
| 48 chrome.test.notifyPass(); | |
| 49 } | |
| 50 }); | |
| 51 } | |
| 52 </script> | |
| OLD | NEW |