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

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

Issue 47923018: Move FeatureSwitch to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 "chrome/browser/extensions/active_tab_permission_granter.h" 5 #include "chrome/browser/extensions/active_tab_permission_granter.h"
6 #include "chrome/browser/extensions/browser_action_test_util.h" 6 #include "chrome/browser/extensions/browser_action_test_util.h"
7 #include "chrome/browser/extensions/extension_action.h" 7 #include "chrome/browser/extensions/extension_action.h"
8 #include "chrome/browser/extensions/extension_action_manager.h" 8 #include "chrome/browser/extensions/extension_action_manager.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/tab_helper.h" 10 #include "chrome/browser/extensions/tab_helper.h"
11 #include "chrome/browser/sessions/session_tab_helper.h" 11 #include "chrome/browser/sessions/session_tab_helper.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/extensions/permissions/permissions_data.h" 15 #include "chrome/common/extensions/permissions/permissions_data.h"
17 #include "chrome/test/base/interactive_test_utils.h" 16 #include "chrome/test/base/interactive_test_utils.h"
18 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
21 #include "extensions/common/feature_switch.h"
22 22
23 using content::WebContents; 23 using content::WebContents;
24 24
25 namespace extensions { 25 namespace extensions {
26 26
27 class CommandsApiTest : public ExtensionApiTest { 27 class CommandsApiTest : public ExtensionApiTest {
28 public: 28 public:
29 CommandsApiTest() {} 29 CommandsApiTest() {}
30 virtual ~CommandsApiTest() {} 30 virtual ~CommandsApiTest() {}
31 31
32 protected: 32 protected:
33 BrowserActionTestUtil GetBrowserActionsBar() { 33 BrowserActionTestUtil GetBrowserActionsBar() {
34 return BrowserActionTestUtil(browser()); 34 return BrowserActionTestUtil(browser());
35 } 35 }
36 36
37 bool IsGrantedForTab(const Extension* extension, 37 bool IsGrantedForTab(const Extension* extension,
38 const content::WebContents* web_contents) { 38 const content::WebContents* web_contents) {
39 return PermissionsData::HasAPIPermissionForTab( 39 return PermissionsData::HasAPIPermissionForTab(
40 extension, 40 extension,
41 SessionID::IdForTab(web_contents), 41 SessionID::IdForTab(web_contents),
42 APIPermission::kTab); 42 APIPermission::kTab);
43 } 43 }
44 }; 44 };
45 45
46 class ScriptBadgesCommandsApiTest : public ExtensionApiTest { 46 class ScriptBadgesCommandsApiTest : public ExtensionApiTest {
47 public: 47 public:
48 ScriptBadgesCommandsApiTest() { 48 ScriptBadgesCommandsApiTest() {
49 // We cannot add this to CommandsApiTest because then PageActions get 49 // We cannot add this to CommandsApiTest because then PageActions get
50 // treated like BrowserActions and the PageAction test starts failing. 50 // treated like BrowserActions and the PageAction test starts failing.
51 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 51 FeatureSwitch::script_badges()->SetOverrideValue(
52 switches::kScriptBadges, "1"); 52 FeatureSwitch::OVERRIDE_ENABLED);
53 } 53 }
54 virtual ~ScriptBadgesCommandsApiTest() {} 54 virtual ~ScriptBadgesCommandsApiTest() {}
55 }; 55 };
56 56
57 // Test the basic functionality of the Keybinding API: 57 // Test the basic functionality of the Keybinding API:
58 // - That pressing the shortcut keys should perform actions (activate the 58 // - That pressing the shortcut keys should perform actions (activate the
59 // browser action or send an event). 59 // browser action or send an event).
60 // - Note: Page action keybindings are tested in PageAction test below. 60 // - Note: Page action keybindings are tested in PageAction test below.
61 // - The shortcut keys taken by one extension are not overwritten by the last 61 // - The shortcut keys taken by one extension are not overwritten by the last
62 // installed extension. 62 // installed extension.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 255 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
256 tab, 256 tab,
257 "setInterval(function() {" 257 "setInterval(function() {"
258 " if (document.body.bgColor == 'blue') {" 258 " if (document.body.bgColor == 'blue') {"
259 " window.domAutomationController.send(true)}}, 100)", 259 " window.domAutomationController.send(true)}}, 100)",
260 &result)); 260 &result));
261 ASSERT_TRUE(result); 261 ASSERT_TRUE(result);
262 } 262 }
263 263
264 } // namespace extensions 264 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698