Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/test/data/extensions/api_test/incognito/apis/background.js

Issue 1984573002: Prevent chrome.windows.create from moving a tab to another profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Devlin's nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 });
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698