| 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 normalWindow, normalTab; | 5 var normalWindow, normalTab; |
| 6 var incognitoWindow, incognitoTab; | 6 var incognitoWindow, incognitoTab; |
| 7 | 7 |
| 8 var pass = chrome.test.callbackPass; | 8 var pass = chrome.test.callbackPass; |
| 9 var fail = chrome.test.callbackFail; | 9 var fail = chrome.test.callbackFail; |
| 10 var assertEq = chrome.test.assertEq; | 10 var assertEq = chrome.test.assertEq; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 var errorMsg = "Tabs can only be moved between " + | 119 var errorMsg = "Tabs can only be moved between " + |
| 120 "windows in the same profile."; | 120 "windows in the same profile."; |
| 121 | 121 |
| 122 // Create a tab in the non-incognito window... | 122 // Create a tab in the non-incognito window... |
| 123 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'}, | 123 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'}, |
| 124 pass(function(tab) { | 124 pass(function(tab) { |
| 125 // ... and then try to move it to the incognito window. | 125 // ... and then try to move it to the incognito window. |
| 126 chrome.tabs.move(tab.id, | 126 chrome.tabs.move(tab.id, |
| 127 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg)); | 127 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg)); |
| 128 })); | 128 })); |
| 129 }, |
| 130 |
| 131 // Tests that it is not possible to create a new window with a tab from a |
| 132 // different profile. |
| 133 function createWindowWithTabFromOtherProfile() { |
| 134 chrome.windows.create({ |
| 135 tabId: incognitoTab.id, |
| 136 }, fail('Tabs can only be moved between windows in the same profile.')); |
| 137 }, |
| 138 |
| 139 // Similarly, try to move a non-incognito tab to an incognito window. |
| 140 function createWindowWithTabFromOtherProfile2() { |
| 141 chrome.windows.create({ |
| 142 tabId: normalTab.id, |
| 143 incognito: true, |
| 144 }, fail('Tabs can only be moved between windows in the same profile.')); |
| 129 } | 145 } |
| 130 ]); | 146 ]); |
| 131 }); | 147 }); |
| OLD | NEW |