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

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

Issue 819133004: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 30 matching lines...) Expand all
41 // TODO(stevenjb): Figure out the correct behavior for Ash + Win 41 // TODO(stevenjb): Figure out the correct behavior for Ash + Win
42 #define USE_ASH_PANELS 42 #define USE_ASH_PANELS
43 #endif 43 #endif
44 44
45 using content::OpenURLParams; 45 using content::OpenURLParams;
46 using content::Referrer; 46 using content::Referrer;
47 using content::WebContents; 47 using content::WebContents;
48 48
49 // Disabled, http://crbug.com/64899. 49 // Disabled, http://crbug.com/64899.
50 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) { 50 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) {
51 CommandLine::ForCurrentProcess()->AppendSwitch( 51 base::CommandLine::ForCurrentProcess()->AppendSwitch(
52 extensions::switches::kEnableExperimentalExtensionApis); 52 extensions::switches::kEnableExperimentalExtensionApis);
53 53
54 extensions::ResultCatcher catcher; 54 extensions::ResultCatcher catcher;
55 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ 55 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_
56 .AppendASCII("window_open").AppendASCII("spanning"))); 56 .AppendASCII("window_open").AppendASCII("spanning")));
57 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 57 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
58 } 58 }
59 59
60 int GetPanelCount(Browser* browser) { 60 int GetPanelCount(Browser* browser) {
61 #if defined(USE_ASH_PANELS) 61 #if defined(USE_ASH_PANELS)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 ui::PAGE_TRANSITION_TYPED, false)); 225 ui::PAGE_TRANSITION_TYPED, false));
226 226
227 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 3, 1, 0)); 227 EXPECT_TRUE(WaitForTabsAndPopups(browser(), 3, 1, 0));
228 } 228 }
229 229
230 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowArgumentsOverflow) { 230 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowArgumentsOverflow) {
231 ASSERT_TRUE(RunExtensionTest("window_open/argument_overflow")) << message_; 231 ASSERT_TRUE(RunExtensionTest("window_open/argument_overflow")) << message_;
232 } 232 }
233 233
234 class WindowOpenPanelDisabledTest : public ExtensionApiTest { 234 class WindowOpenPanelDisabledTest : public ExtensionApiTest {
235 void SetUpCommandLine(CommandLine* command_line) override { 235 void SetUpCommandLine(base::CommandLine* command_line) override {
236 ExtensionApiTest::SetUpCommandLine(command_line); 236 ExtensionApiTest::SetUpCommandLine(command_line);
237 // TODO(jennb): Re-enable when panels are enabled by default. 237 // TODO(jennb): Re-enable when panels are enabled by default.
238 // command_line->AppendSwitch(switches::kDisablePanels); 238 // command_line->AppendSwitch(switches::kDisablePanels);
239 } 239 }
240 }; 240 };
241 241
242 IN_PROC_BROWSER_TEST_F(WindowOpenPanelDisabledTest, 242 IN_PROC_BROWSER_TEST_F(WindowOpenPanelDisabledTest,
243 DISABLED_WindowOpenPanelNotEnabled) { 243 DISABLED_WindowOpenPanelNotEnabled) {
244 ASSERT_TRUE(RunExtensionTest("window_open/panel_not_enabled")) << message_; 244 ASSERT_TRUE(RunExtensionTest("window_open/panel_not_enabled")) << message_;
245 } 245 }
246 246
247 class WindowOpenPanelTest : public ExtensionApiTest { 247 class WindowOpenPanelTest : public ExtensionApiTest {
248 void SetUpCommandLine(CommandLine* command_line) override { 248 void SetUpCommandLine(base::CommandLine* command_line) override {
249 ExtensionApiTest::SetUpCommandLine(command_line); 249 ExtensionApiTest::SetUpCommandLine(command_line);
250 command_line->AppendSwitch(switches::kEnablePanels); 250 command_line->AppendSwitch(switches::kEnablePanels);
251 } 251 }
252 }; 252 };
253 253
254 #if defined(USE_ASH_PANELS) 254 #if defined(USE_ASH_PANELS)
255 // On Ash, this currently fails because we're currently opening new panel 255 // On Ash, this currently fails because we're currently opening new panel
256 // windows as popup windows instead. 256 // windows as popup windows instead.
257 #define MAYBE_WindowOpenPanel DISABLED_WindowOpenPanel 257 #define MAYBE_WindowOpenPanel DISABLED_WindowOpenPanel
258 #else 258 #else
(...skipping 21 matching lines...) Expand all
280 #define MAYBE_CloseNonExtensionPanelsOnUninstall \ 280 #define MAYBE_CloseNonExtensionPanelsOnUninstall \
281 DISABLED_CloseNonExtensionPanelsOnUninstall 281 DISABLED_CloseNonExtensionPanelsOnUninstall
282 #else 282 #else
283 #define MAYBE_CloseNonExtensionPanelsOnUninstall \ 283 #define MAYBE_CloseNonExtensionPanelsOnUninstall \
284 CloseNonExtensionPanelsOnUninstall 284 CloseNonExtensionPanelsOnUninstall
285 #endif 285 #endif
286 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, 286 IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest,
287 MAYBE_CloseNonExtensionPanelsOnUninstall) { 287 MAYBE_CloseNonExtensionPanelsOnUninstall) {
288 #if defined(OS_WIN) && defined(USE_ASH) 288 #if defined(OS_WIN) && defined(USE_ASH)
289 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 289 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
290 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 290 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
291 switches::kAshBrowserTests))
291 return; 292 return;
292 #endif 293 #endif
293 294
294 #if defined(USE_ASH_PANELS) 295 #if defined(USE_ASH_PANELS)
295 // On Ash, new panel windows open as popup windows instead. 296 // On Ash, new panel windows open as popup windows instead.
296 int num_popups, num_panels; 297 int num_popups, num_panels;
297 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePanels)) { 298 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
299 switches::kEnablePanels)) {
298 num_popups = 2; 300 num_popups = 2;
299 num_panels = 2; 301 num_panels = 2;
300 } else { 302 } else {
301 num_popups = 4; 303 num_popups = 4;
302 num_panels = 0; 304 num_panels = 0;
303 } 305 }
304 #else 306 #else
305 int num_popups = 2; 307 int num_popups = 2;
306 int num_panels = 2; 308 int num_panels = 2;
307 #endif 309 #endif
(...skipping 25 matching lines...) Expand all
333 // Wait on test messages to make sure the pages loaded. 335 // Wait on test messages to make sure the pages loaded.
334 for (size_t i = 0; i < listeners.size(); ++i) 336 for (size_t i = 0; i < listeners.size(); ++i)
335 ASSERT_TRUE(listeners[i]->WaitUntilSatisfied()); 337 ASSERT_TRUE(listeners[i]->WaitUntilSatisfied());
336 338
337 UninstallExtension(extension->id()); 339 UninstallExtension(extension->id());
338 340
339 // Wait for the tabs and popups in non-extension domain to stay open. 341 // Wait for the tabs and popups in non-extension domain to stay open.
340 // Expect everything else, including panels, to close. 342 // Expect everything else, including panels, to close.
341 num_popups -= 1; 343 num_popups -= 1;
342 #if defined(USE_ASH_PANELS) 344 #if defined(USE_ASH_PANELS)
343 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePanels)) { 345 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
346 switches::kEnablePanels)) {
344 // On Ash, new panel windows open as popup windows instead, so there are 2 347 // On Ash, new panel windows open as popup windows instead, so there are 2
345 // extension domain popups that will close (instead of 1 popup on non-Ash). 348 // extension domain popups that will close (instead of 1 popup on non-Ash).
346 num_popups -= 1; 349 num_popups -= 1;
347 } 350 }
348 #endif 351 #endif
349 #if defined(USE_ASH) 352 #if defined(USE_ASH)
350 #if !defined(OS_WIN) 353 #if !defined(OS_WIN)
351 // On linux ash we close all popup applications when closing its extension. 354 // On linux ash we close all popup applications when closing its extension.
352 num_popups = 0; 355 num_popups = 0;
353 #endif 356 #endif
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 last_loaded_extension_id() + "/newtab.html"), 506 last_loaded_extension_id() + "/newtab.html"),
504 false, 507 false,
505 &newtab)); 508 &newtab));
506 509
507 // Extension API should succeed. 510 // Extension API should succeed.
508 bool result = false; 511 bool result = false;
509 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", 512 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
510 &result)); 513 &result));
511 EXPECT_TRUE(result); 514 EXPECT_TRUE(result);
512 } 515 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_installer_test.cc ('k') | chrome/browser/extensions/window_open_interactive_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698