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

Side by Side Diff: chrome/browser/extensions/window_open_apitest.cc

Issue 1843943003: Extension-created windows should share the creator's BrowingInstance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 8 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/extension_apitest.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 3, 1, 0)); 224 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 3, 1, 0));
225 } 225 }
226 226
227 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowArgumentsOverflow) { 227 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowArgumentsOverflow) {
228 ASSERT_TRUE(RunExtensionTest("window_open/argument_overflow")) << message_; 228 ASSERT_TRUE(RunExtensionTest("window_open/argument_overflow")) << message_;
229 } 229 }
230 230
231 class WindowOpenPanelDisabledTest : public ExtensionApiTest { 231 class WindowOpenPanelDisabledTest : public ExtensionApiTest {
232 void SetUpCommandLine(base::CommandLine* command_line) override { 232 void SetUpCommandLine(base::CommandLine* command_line) override {
233 ExtensionApiTest::SetUpCommandLine(command_line); 233 ExtensionApiTest::SetUpCommandLine(command_line);
234 // TODO(jennb): Re-enable when panels are enabled by default. 234 command_line->AppendSwitch(switches::kDisablePanels);
235 // command_line->AppendSwitch(switches::kDisablePanels);
236 } 235 }
237 }; 236 };
238 237
239 IN_PROC_BROWSER_TEST_F(WindowOpenPanelDisabledTest, 238 IN_PROC_BROWSER_TEST_F(WindowOpenPanelDisabledTest, WindowOpenPanelNotEnabled) {
240 DISABLED_WindowOpenPanelNotEnabled) {
241 ASSERT_TRUE(RunExtensionTest("window_open/panel_not_enabled")) << message_; 239 ASSERT_TRUE(RunExtensionTest("window_open/panel_not_enabled")) << message_;
242 } 240 }
243 241
244 class WindowOpenPanelTest : public ExtensionApiTest { 242 class WindowOpenPanelTest : public ExtensionApiTest {
245 void SetUpCommandLine(base::CommandLine* command_line) override { 243 void SetUpCommandLine(base::CommandLine* command_line) override {
246 ExtensionApiTest::SetUpCommandLine(command_line); 244 ExtensionApiTest::SetUpCommandLine(command_line);
247 command_line->AppendSwitch(switches::kEnablePanels); 245 command_line->AppendSwitch(switches::kEnablePanels);
248 } 246 }
249 }; 247 };
250 248
(...skipping 23 matching lines...) Expand all
274 // | | | <--------------/ | | 272 // | | | <--------------/ | |
275 // | +---------------------+ | | +-------------------------------+ | 273 // | +---------------------+ | | +-------------------------------+ |
276 // | | | | 274 // | | | |
277 // +-----------------------------+ +-----------------------------------+ 275 // +-----------------------------+ +-----------------------------------+
278 // 276 //
279 // See also crbug.com/568357 for more info / context. 277 // See also crbug.com/568357 for more info / context.
280 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, BrowsingInstanceTest) { 278 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, BrowsingInstanceTest) {
281 host_resolver()->AddRule("*", "127.0.0.1"); 279 host_resolver()->AddRule("*", "127.0.0.1");
282 ASSERT_TRUE(StartEmbeddedTestServer()); 280 ASSERT_TRUE(StartEmbeddedTestServer());
283 281
284 ASSERT_TRUE(RunExtensionTest("window_open/panel_browsing_instance")) 282 ASSERT_TRUE(
283 RunExtensionTestWithArg("window_open/panel_browsing_instance", "panel"))
285 << message_; 284 << message_;
286 } 285 }
287 286
287 // Similar to the previous test, but for when panels are disabled.
288 IN_PROC_BROWSER_TEST_F(WindowOpenPanelDisabledTest, BrowsingInstanceTest) {
289 host_resolver()->AddRule("*", "127.0.0.1");
290 ASSERT_TRUE(StartEmbeddedTestServer());
291
292 ASSERT_TRUE(
293 RunExtensionTestWithArg("window_open/panel_browsing_instance", "popup"))
294 << message_;
295 }
296
288 #if defined(USE_ASH_PANELS) || defined(OS_LINUX) 297 #if defined(USE_ASH_PANELS) || defined(OS_LINUX)
289 // On Ash, this currently fails because we're currently opening new panel 298 // On Ash, this currently fails because we're currently opening new panel
290 // windows as popup windows instead. 299 // windows as popup windows instead.
291 // We're also failing on Linux-aura due to the panel is not opened in the 300 // We're also failing on Linux-aura due to the panel is not opened in the
292 // right origin. 301 // right origin.
293 #define MAYBE_WindowOpenPanelDetached DISABLED_WindowOpenPanelDetached 302 #define MAYBE_WindowOpenPanelDetached DISABLED_WindowOpenPanelDetached
294 #else 303 #else
295 #define MAYBE_WindowOpenPanelDetached WindowOpenPanelDetached 304 #define MAYBE_WindowOpenPanelDetached WindowOpenPanelDetached
296 #endif 305 #endif
297 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) { 306 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 last_loaded_extension_id() + "/newtab.html"), 538 last_loaded_extension_id() + "/newtab.html"),
530 false, 539 false,
531 &newtab)); 540 &newtab));
532 541
533 // Extension API should succeed. 542 // Extension API should succeed.
534 bool result = false; 543 bool result = false;
535 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", 544 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
536 &result)); 545 &result));
537 EXPECT_TRUE(result); 546 EXPECT_TRUE(result);
538 } 547 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_apitest.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698