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

Unified Diff: chrome/test/data/extensions/api_test/window_open/panel_browsing_instance/background.js

Issue 1843943003: Extension-created windows should share the creator's BrowingInstance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up stray include and fix unrelated unit test Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/window_open/panel_browsing_instance/background.js
diff --git a/chrome/test/data/extensions/api_test/window_open/panel_browsing_instance/background.js b/chrome/test/data/extensions/api_test/window_open/panel_browsing_instance/background.js
index f32f4f86132234d643191c68194b7ee9f184c4eb..4653b878dcdaf7dbafefb20823ff6ee3abfb8f3c 100644
--- a/chrome/test/data/extensions/api_test/window_open/panel_browsing_instance/background.js
+++ b/chrome/test/data/extensions/api_test/window_open/panel_browsing_instance/background.js
@@ -7,6 +7,7 @@
chrome.test.log('executing background.js ...');
var oldNumberOfTabs;
+var expectedWindowType;
chrome.test.runTests([
function testPanelBrowsingInstance() {
chrome.test.log('counting all the tabs (before window.open) ...');
@@ -23,6 +24,8 @@ chrome.test.runTests([
// attempting navigation is neither same-origin with the target, nor is
// it the target's parent or opener.
chrome.test.getConfig(function(config) {
+ expectedWindowType = config.customArg;
+
var baseUri = 'http://foo.com:' + config.testServer.port +
'/extensions/api_test/window_open/panel_browsing_instance/';
@@ -47,7 +50,7 @@ chrome.runtime.onMessageExternal.addListener(
chrome.windows.create(
{ 'url': chrome.extension.getURL('panel.html'), 'type': 'panel' },
function(win) {
- chrome.test.assertEq('panel', win.type);
+ chrome.test.assertEq(expectedWindowType, win.type);
});
// panel.js will navigate panel-subframe and then panel-subframe.js will
@@ -60,7 +63,17 @@ chrome.runtime.onMessageExternal.addListener(
var newNumberOfTabs = tabs.length;
chrome.test.log('newNumberOfTabs = ' + newNumberOfTabs);
- chrome.test.assertEq(newNumberOfTabs, oldNumberOfTabs);
+ switch (expectedWindowType) {
+ case 'panel':
Devlin 2016/04/01 17:20:57 indentation
dcheng 2016/04/01 17:42:00 Done.
+ chrome.test.assertEq(newNumberOfTabs, oldNumberOfTabs);
+ break;
+ case 'popup':
+ chrome.test.assertEq(newNumberOfTabs, oldNumberOfTabs + 1);
+ break;
+ default:
+ // Unexpected expected window type.
+ chrome.test.fail();
+ }
chrome.test.notifyPass();
});
}
« chrome/browser/extensions/api/tabs/tabs_api.cc ('K') | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698