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