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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/extensions/active_script_controller.h" | 10 #include "chrome/browser/extensions/active_script_controller.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 28 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
29 #include "chrome/browser/chromeos/settings/cros_settings.h" | 29 #include "chrome/browser/chromeos/settings/cros_settings.h" |
30 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 30 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
31 #endif | 31 #endif |
32 | 32 |
33 namespace extensions { | 33 namespace extensions { |
34 namespace { | 34 namespace { |
35 | 35 |
36 class LocationBarControllerUnitTest : public ChromeRenderViewHostTestHarness { | 36 class LocationBarControllerUnitTest : public ChromeRenderViewHostTestHarness { |
37 protected: | 37 protected: |
38 virtual void SetUp() OVERRIDE { | 38 virtual void SetUp() override { |
39 active_script_override_.reset(new FeatureSwitch::ScopedOverride( | 39 active_script_override_.reset(new FeatureSwitch::ScopedOverride( |
40 FeatureSwitch::scripts_require_action(), true)); | 40 FeatureSwitch::scripts_require_action(), true)); |
41 | 41 |
42 ChromeRenderViewHostTestHarness::SetUp(); | 42 ChromeRenderViewHostTestHarness::SetUp(); |
43 #if defined OS_CHROMEOS | 43 #if defined OS_CHROMEOS |
44 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 44 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
45 #endif | 45 #endif |
46 TabHelper::CreateForWebContents(web_contents()); | 46 TabHelper::CreateForWebContents(web_contents()); |
47 // Create an ExtensionService so the LocationBarController can find its | 47 // Create an ExtensionService so the LocationBarController can find its |
48 // extensions. | 48 // extensions. |
49 CommandLine command_line(CommandLine::NO_PROGRAM); | 49 CommandLine command_line(CommandLine::NO_PROGRAM); |
50 Profile* profile = | 50 Profile* profile = |
51 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 51 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
52 extension_service_ = static_cast<TestExtensionSystem*>( | 52 extension_service_ = static_cast<TestExtensionSystem*>( |
53 ExtensionSystem::Get(profile))->CreateExtensionService( | 53 ExtensionSystem::Get(profile))->CreateExtensionService( |
54 &command_line, base::FilePath(), false); | 54 &command_line, base::FilePath(), false); |
55 } | 55 } |
56 | 56 |
57 virtual void TearDown() OVERRIDE { | 57 virtual void TearDown() override { |
58 #if defined OS_CHROMEOS | 58 #if defined OS_CHROMEOS |
59 test_user_manager_.reset(); | 59 test_user_manager_.reset(); |
60 #endif | 60 #endif |
61 ChromeRenderViewHostTestHarness::TearDown(); | 61 ChromeRenderViewHostTestHarness::TearDown(); |
62 } | 62 } |
63 | 63 |
64 int tab_id() { | 64 int tab_id() { |
65 return SessionTabHelper::IdForTab(web_contents()); | 65 return SessionTabHelper::IdForTab(web_contents()); |
66 } | 66 } |
67 | 67 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 NavigateAndCommit(GURL("http://www.yahoo.com")); | 188 NavigateAndCommit(GURL("http://www.yahoo.com")); |
189 | 189 |
190 EXPECT_EQ("Hello", page_action.GetTitle(tab_id())); | 190 EXPECT_EQ("Hello", page_action.GetTitle(tab_id())); |
191 EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id())); | 191 EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id())); |
192 EXPECT_FALSE(extension_action_api->ExtensionWantsToRun(extension, | 192 EXPECT_FALSE(extension_action_api->ExtensionWantsToRun(extension, |
193 web_contents())); | 193 web_contents())); |
194 } | 194 } |
195 | 195 |
196 } // namespace | 196 } // namespace |
197 } // namespace extensions | 197 } // namespace extensions |
OLD | NEW |