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/browser_action_test_util.h" | 7 #include "chrome/browser/extensions/browser_action_test_util.h" |
8 #include "chrome/browser/extensions/extension_action.h" | 8 #include "chrome/browser/extensions/extension_action.h" |
9 #include "chrome/browser/extensions/extension_action_manager.h" | 9 #include "chrome/browser/extensions/extension_action_manager.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 CommandsApiTest() {} | 30 CommandsApiTest() {} |
31 virtual ~CommandsApiTest() {} | 31 virtual ~CommandsApiTest() {} |
32 | 32 |
33 protected: | 33 protected: |
34 BrowserActionTestUtil GetBrowserActionsBar() { | 34 BrowserActionTestUtil GetBrowserActionsBar() { |
35 return BrowserActionTestUtil(browser()); | 35 return BrowserActionTestUtil(browser()); |
36 } | 36 } |
37 | 37 |
38 bool IsGrantedForTab(const Extension* extension, | 38 bool IsGrantedForTab(const Extension* extension, |
39 const content::WebContents* web_contents) { | 39 const content::WebContents* web_contents) { |
40 return PermissionsData::HasAPIPermissionForTab( | 40 return PermissionsData::ForExtension(extension)->HasAPIPermissionForTab( |
41 extension, | 41 SessionID::IdForTab(web_contents), APIPermission::kTab); |
42 SessionID::IdForTab(web_contents), | |
43 APIPermission::kTab); | |
44 } | 42 } |
45 }; | 43 }; |
46 | 44 |
47 // Test the basic functionality of the Keybinding API: | 45 // Test the basic functionality of the Keybinding API: |
48 // - That pressing the shortcut keys should perform actions (activate the | 46 // - That pressing the shortcut keys should perform actions (activate the |
49 // browser action or send an event). | 47 // browser action or send an event). |
50 // - Note: Page action keybindings are tested in PageAction test below. | 48 // - Note: Page action keybindings are tested in PageAction test below. |
51 // - The shortcut keys taken by one extension are not overwritten by the last | 49 // - The shortcut keys taken by one extension are not overwritten by the last |
52 // installed extension. | 50 // installed extension. |
53 IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) { | 51 IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Activate the Media Stop key. | 289 // Activate the Media Stop key. |
292 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 290 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
293 browser(), ui::VKEY_MEDIA_STOP, false, false, false, false)); | 291 browser(), ui::VKEY_MEDIA_STOP, false, false, false, false)); |
294 | 292 |
295 // We should get two success result. | 293 // We should get two success result. |
296 ASSERT_TRUE(catcher.GetNextResult()); | 294 ASSERT_TRUE(catcher.GetNextResult()); |
297 ASSERT_TRUE(catcher.GetNextResult()); | 295 ASSERT_TRUE(catcher.GetNextResult()); |
298 } | 296 } |
299 | 297 |
300 } // namespace extensions | 298 } // namespace extensions |
OLD | NEW |