| 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 "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 6 #include "chrome/browser/extensions/extension_action.h" | 6 #include "chrome/browser/extensions/extension_action.h" |
| 7 #include "chrome/browser/extensions/extension_action_manager.h" | 7 #include "chrome/browser/extensions/extension_action_manager.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| 11 #include "chrome/browser/extensions/location_bar_controller.h" | 11 #include "chrome/browser/extensions/location_bar_controller.h" |
| 12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/common/chrome_switches.h" | |
| 17 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/features/feature_channel.h" | 17 #include "chrome/common/extensions/features/feature_channel.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "extensions/common/feature_switch.h" |
| 21 #include "net/dns/mock_host_resolver.h" | 21 #include "net/dns/mock_host_resolver.h" |
| 22 #include "net/test/embedded_test_server/embedded_test_server.h" | 22 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class ScriptBadgeApiTest : public ExtensionApiTest { | 28 class ScriptBadgeApiTest : public ExtensionApiTest { |
| 29 public: | 29 public: |
| 30 ScriptBadgeApiTest() : trunk_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} | 30 ScriptBadgeApiTest() : trunk_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 33 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 34 ExtensionApiTest::SetUpCommandLine(command_line); | 34 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 35 command_line->AppendSwitchASCII(switches::kScriptBadges, "1"); | 35 FeatureSwitch::script_badges()->SetOverrideValue( |
| 36 FeatureSwitch::OVERRIDE_ENABLED); |
| 36 } | 37 } |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 extensions::ScopedCurrentChannel trunk_; | 40 extensions::ScopedCurrentChannel trunk_; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { | 43 IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { |
| 43 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 44 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 44 ASSERT_TRUE(RunExtensionTest("script_badge/basics")) << message_; | 45 ASSERT_TRUE(RunExtensionTest("script_badge/basics")) << message_; |
| 45 const Extension* extension = GetSingleLoadedExtension(); | 46 const Extension* extension = GetSingleLoadedExtension(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 browser(), embedded_test_server()->GetURL("/title1.html")); | 91 browser(), embedded_test_server()->GetURL("/title1.html")); |
| 91 ASSERT_TRUE(catcher.GetNextResult()); | 92 ASSERT_TRUE(catcher.GetNextResult()); |
| 92 } | 93 } |
| 93 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); | 94 EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); |
| 94 EXPECT_THAT(location_bar_controller->GetCurrentActions(), | 95 EXPECT_THAT(location_bar_controller->GetCurrentActions(), |
| 95 testing::ElementsAre(script_badge)); | 96 testing::ElementsAre(script_badge)); |
| 96 } | 97 } |
| 97 | 98 |
| 98 } // namespace | 99 } // namespace |
| 99 } // namespace extensions | 100 } // namespace extensions |
| OLD | NEW |