| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extension_web_ui.h" | 5 #include "chrome/browser/extensions/extension_web_ui.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_web_ui_override_registrar.h" | 13 #include "chrome/browser/extensions/extension_web_ui_override_registrar.h" |
| 13 #include "chrome/browser/extensions/test_extension_system.h" | 14 #include "chrome/browser/extensions/test_extension_system.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
| 15 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
| 16 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
| 17 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 18 #include "extensions/common/extension_builder.h" | 19 #include "extensions/common/extension_builder.h" |
| 19 #include "extensions/common/manifest_constants.h" | 20 #include "extensions/common/manifest_constants.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile_.get())); | 49 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile_.get())); |
| 49 extension_service_ = system->CreateExtensionService( | 50 extension_service_ = system->CreateExtensionService( |
| 50 base::CommandLine::ForCurrentProcess(), base::FilePath(), false); | 51 base::CommandLine::ForCurrentProcess(), base::FilePath(), false); |
| 51 ExtensionWebUIOverrideRegistrar::GetFactoryInstance()->SetTestingFactory( | 52 ExtensionWebUIOverrideRegistrar::GetFactoryInstance()->SetTestingFactory( |
| 52 profile_.get(), &BuildOverrideRegistrar); | 53 profile_.get(), &BuildOverrideRegistrar); |
| 53 ExtensionWebUIOverrideRegistrar::GetFactoryInstance()->Get(profile_.get()); | 54 ExtensionWebUIOverrideRegistrar::GetFactoryInstance()->Get(profile_.get()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void TearDown() override { | 57 void TearDown() override { |
| 57 profile_.reset(); | 58 profile_.reset(); |
| 58 message_loop_.RunUntilIdle(); | 59 base::RunLoop().RunUntilIdle(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 std::unique_ptr<TestingProfile> profile_; | 62 std::unique_ptr<TestingProfile> profile_; |
| 62 ExtensionService* extension_service_; | 63 ExtensionService* extension_service_; |
| 63 base::MessageLoop message_loop_; | 64 base::MessageLoop message_loop_; |
| 64 content::TestBrowserThread ui_thread_; | 65 content::TestBrowserThread ui_thread_; |
| 65 | 66 |
| 66 #if defined OS_CHROMEOS | 67 #if defined OS_CHROMEOS |
| 67 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 68 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 68 chromeos::ScopedTestCrosSettings test_cros_settings_; | 69 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 changed_url = kBookmarksUrl; | 155 changed_url = kBookmarksUrl; |
| 155 EXPECT_TRUE( | 156 EXPECT_TRUE( |
| 156 ExtensionWebUI::HandleChromeURLOverride(&changed_url, profile_.get())); | 157 ExtensionWebUI::HandleChromeURLOverride(&changed_url, profile_.get())); |
| 157 EXPECT_EQ(kExpectedUnpackedOverrideUrl, changed_url); | 158 EXPECT_EQ(kExpectedUnpackedOverrideUrl, changed_url); |
| 158 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverrideReverse(&changed_url, | 159 EXPECT_TRUE(ExtensionWebUI::HandleChromeURLOverrideReverse(&changed_url, |
| 159 profile_.get())); | 160 profile_.get())); |
| 160 EXPECT_EQ(kBookmarksUrl, changed_url); | 161 EXPECT_EQ(kBookmarksUrl, changed_url); |
| 161 } | 162 } |
| 162 | 163 |
| 163 } // namespace extensions | 164 } // namespace extensions |
| OLD | NEW |