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

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

Issue 554073002: Reland 189a2ed4d209231d517b0e64a722722dead3f17a Fixes HasEventListener check in ExtensionKeybindingR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | chrome/browser/extensions/extension_keybinding_registry.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 "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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 694
695 // Verify the keybinding is still set. 695 // Verify the keybinding is still set.
696 accelerator = command_service->FindCommandByName( 696 accelerator = command_service->FindCommandByName(
697 kId, manifest_values::kBrowserActionCommandEvent).accelerator(); 697 kId, manifest_values::kBrowserActionCommandEvent).accelerator();
698 EXPECT_EQ(ui::VKEY_G, accelerator.key_code()); 698 EXPECT_EQ(ui::VKEY_G, accelerator.key_code());
699 EXPECT_FALSE(accelerator.IsCtrlDown()); 699 EXPECT_FALSE(accelerator.IsCtrlDown());
700 EXPECT_TRUE(accelerator.IsShiftDown()); 700 EXPECT_TRUE(accelerator.IsShiftDown());
701 EXPECT_TRUE(accelerator.IsAltDown()); 701 EXPECT_TRUE(accelerator.IsAltDown());
702 } 702 }
703 703
704 IN_PROC_BROWSER_TEST_F(CommandsApiTest, ContinuePropagation) { 704 //
705 #if defined(OS_CHROMEOS) && !defined(NDEBUG)
706 // TODO(dtseng): Test times out on Chrome OS debug. See http://crbug.com/412456.
707 #define MAYBE_ContinuePropagation DISABLED_ContinuePropagation
708 #else
709 #define MAYBE_ContinuePropagation ContinuePropagation
710 #endif
711
712 IN_PROC_BROWSER_TEST_F(CommandsApiTest, MAYBE_ContinuePropagation) {
705 // Setup the environment. 713 // Setup the environment.
706 ASSERT_TRUE(test_server()->Start()); 714 ASSERT_TRUE(test_server()->Start());
707 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 715 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
708 ASSERT_TRUE(RunExtensionTest("keybinding/continue_propagation")) << message_; 716 ASSERT_TRUE(RunExtensionTest("keybinding/continue_propagation")) << message_;
709 ui_test_utils::NavigateToURL( 717 ui_test_utils::NavigateToURL(
710 browser(), test_server()->GetURL("files/extensions/test_file.txt")); 718 browser(), test_server()->GetURL("files/extensions/test_file.txt"));
711 719
712 ResultCatcher catcher; 720 ResultCatcher catcher;
713 721
714 // Activate the shortcut (Ctrl+Shift+F). The page should capture the 722 // Activate the shortcut (Ctrl+Shift+F). The page should capture the
(...skipping 10 matching lines...) Expand all
725 ASSERT_TRUE(catcher.GetNextResult()); 733 ASSERT_TRUE(catcher.GetNextResult());
726 734
727 // The extension should now have removed its |onCommand| event listener. 735 // The extension should now have removed its |onCommand| event listener.
728 // Finally, the page should again receive the key. 736 // Finally, the page should again receive the key.
729 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 737 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
730 browser(), ui::VKEY_F, true, true, false, false)); 738 browser(), ui::VKEY_F, true, true, false, false));
731 ASSERT_TRUE(catcher.GetNextResult()); 739 ASSERT_TRUE(catcher.GetNextResult());
732 } 740 }
733 741
734 } // namespace extensions 742 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_keybinding_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698