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

Side by Side Diff: chrome/browser/extensions/extension_keybinding_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 6 years 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 "chrome/browser/extensions/active_tab_permission_granter.h" 6 #include "chrome/browser/extensions/active_tab_permission_granter.h"
7 #include "chrome/browser/extensions/api/commands/command_service.h" 7 #include "chrome/browser/extensions/api/commands/command_service.h"
8 #include "chrome/browser/extensions/browser_action_test_util.h" 8 #include "chrome/browser/extensions/browser_action_test_util.h"
9 #include "chrome/browser/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_action_manager.h" 10 #include "chrome/browser/extensions/extension_action_manager.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 // This test validates that an extension can override the Chrome bookmark 271 // This test validates that an extension can override the Chrome bookmark
272 // shortcut if it has requested to do so. 272 // shortcut if it has requested to do so.
273 IN_PROC_BROWSER_TEST_F(CommandsApiTest, OverwriteBookmarkShortcut) { 273 IN_PROC_BROWSER_TEST_F(CommandsApiTest, OverwriteBookmarkShortcut) {
274 ASSERT_TRUE(test_server()->Start()); 274 ASSERT_TRUE(test_server()->Start());
275 275
276 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 276 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
277 277
278 // This functionality requires a feature flag. 278 // This functionality requires a feature flag.
279 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 279 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
280 "--enable-override-bookmarks-ui", 280 "--enable-override-bookmarks-ui", "1");
281 "1");
282 281
283 ASSERT_TRUE(RunExtensionTest("keybinding/overwrite_bookmark_shortcut")) 282 ASSERT_TRUE(RunExtensionTest("keybinding/overwrite_bookmark_shortcut"))
284 << message_; 283 << message_;
285 284
286 ui_test_utils::NavigateToURL(browser(), 285 ui_test_utils::NavigateToURL(browser(),
287 test_server()->GetURL("files/extensions/test_file.txt")); 286 test_server()->GetURL("files/extensions/test_file.txt"));
288 287
289 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 288 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
290 ASSERT_TRUE(tab); 289 ASSERT_TRUE(tab);
291 290
(...skipping 22 matching lines...) Expand all
314 313
315 // This test validates that an extension override of the Chrome bookmark 314 // This test validates that an extension override of the Chrome bookmark
316 // shortcut does not supersede the same keybinding by web pages. 315 // shortcut does not supersede the same keybinding by web pages.
317 IN_PROC_BROWSER_TEST_F(CommandsApiTest, 316 IN_PROC_BROWSER_TEST_F(CommandsApiTest,
318 OverwriteBookmarkShortcutDoesNotOverrideWebKeybinding) { 317 OverwriteBookmarkShortcutDoesNotOverrideWebKeybinding) {
319 ASSERT_TRUE(test_server()->Start()); 318 ASSERT_TRUE(test_server()->Start());
320 319
321 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 320 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
322 321
323 // This functionality requires a feature flag. 322 // This functionality requires a feature flag.
324 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 323 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
325 "--enable-override-bookmarks-ui", 324 "--enable-override-bookmarks-ui", "1");
326 "1");
327 325
328 ASSERT_TRUE(RunExtensionTest("keybinding/overwrite_bookmark_shortcut")) 326 ASSERT_TRUE(RunExtensionTest("keybinding/overwrite_bookmark_shortcut"))
329 << message_; 327 << message_;
330 328
331 ui_test_utils::NavigateToURL(browser(), 329 ui_test_utils::NavigateToURL(browser(),
332 test_server()->GetURL( 330 test_server()->GetURL(
333 "files/extensions/test_file_with_ctrl-d_keybinding.html")); 331 "files/extensions/test_file_with_ctrl-d_keybinding.html"));
334 332
335 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 333 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
336 ASSERT_TRUE(tab); 334 ASSERT_TRUE(tab);
(...skipping 21 matching lines...) Expand all
358 // This test validates that user-set override of the Chrome bookmark shortcut in 356 // This test validates that user-set override of the Chrome bookmark shortcut in
359 // an extension that does not request it does supersede the same keybinding by 357 // an extension that does not request it does supersede the same keybinding by
360 // web pages. 358 // web pages.
361 IN_PROC_BROWSER_TEST_F(CommandsApiTest, 359 IN_PROC_BROWSER_TEST_F(CommandsApiTest,
362 OverwriteBookmarkShortcutByUserOverridesWebKeybinding) { 360 OverwriteBookmarkShortcutByUserOverridesWebKeybinding) {
363 ASSERT_TRUE(test_server()->Start()); 361 ASSERT_TRUE(test_server()->Start());
364 362
365 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 363 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
366 364
367 // This functionality requires a feature flag. 365 // This functionality requires a feature flag.
368 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 366 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
369 "--enable-override-bookmarks-ui", 367 "--enable-override-bookmarks-ui", "1");
370 "1");
371 368
372 ASSERT_TRUE(RunExtensionTest("keybinding/basics")) 369 ASSERT_TRUE(RunExtensionTest("keybinding/basics"))
373 << message_; 370 << message_;
374 371
375 CommandService* command_service = CommandService::Get(browser()->profile()); 372 CommandService* command_service = CommandService::Get(browser()->profile());
376 373
377 const Extension* extension = GetSingleLoadedExtension(); 374 const Extension* extension = GetSingleLoadedExtension();
378 // Simulate the user setting the keybinding to Ctrl+D. 375 // Simulate the user setting the keybinding to Ctrl+D.
379 #if defined(OS_MACOSX) 376 #if defined(OS_MACOSX)
380 const char hotkey[] = "Command+D"; 377 const char hotkey[] = "Command+D";
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 #define MAYBE_ChromeOSConversions DISABLED_ChromeOSConversions 827 #define MAYBE_ChromeOSConversions DISABLED_ChromeOSConversions
831 #else 828 #else
832 #define MAYBE_ChromeOSConversions ChromeOSConversions 829 #define MAYBE_ChromeOSConversions ChromeOSConversions
833 #endif 830 #endif
834 IN_PROC_BROWSER_TEST_F(CommandsApiTest, MAYBE_ChromeOSConversions) { 831 IN_PROC_BROWSER_TEST_F(CommandsApiTest, MAYBE_ChromeOSConversions) {
835 RunChromeOSConversionTest("keybinding/chromeos_conversions"); 832 RunChromeOSConversionTest("keybinding/chromeos_conversions");
836 } 833 }
837 #endif // OS_CHROMEOS 834 #endif // OS_CHROMEOS
838 835
839 } // namespace extensions 836 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698