OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual ~CommandsApiTest() {} | 44 virtual ~CommandsApiTest() {} |
45 | 45 |
46 protected: | 46 protected: |
47 BrowserActionTestUtil GetBrowserActionsBar() { | 47 BrowserActionTestUtil GetBrowserActionsBar() { |
48 return BrowserActionTestUtil(browser()); | 48 return BrowserActionTestUtil(browser()); |
49 } | 49 } |
50 | 50 |
51 bool IsGrantedForTab(const Extension* extension, | 51 bool IsGrantedForTab(const Extension* extension, |
52 const content::WebContents* web_contents) { | 52 const content::WebContents* web_contents) { |
53 return extension->permissions_data()->HasAPIPermissionForTab( | 53 return extension->permissions_data()->HasAPIPermissionForTab( |
54 SessionID::IdForTab(web_contents), APIPermission::kTab); | 54 SessionTabHelper::IdForTab(web_contents), APIPermission::kTab); |
55 } | 55 } |
56 }; | 56 }; |
57 | 57 |
58 // Test the basic functionality of the Keybinding API: | 58 // Test the basic functionality of the Keybinding API: |
59 // - That pressing the shortcut keys should perform actions (activate the | 59 // - That pressing the shortcut keys should perform actions (activate the |
60 // browser action or send an event). | 60 // browser action or send an event). |
61 // - Note: Page action keybindings are tested in PageAction test below. | 61 // - Note: Page action keybindings are tested in PageAction test below. |
62 // - The shortcut keys taken by one extension are not overwritten by the last | 62 // - The shortcut keys taken by one extension are not overwritten by the last |
63 // installed extension. | 63 // installed extension. |
64 IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) { | 64 IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) { |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } // namespace extensions | 704 } // namespace extensions |
OLD | NEW |