| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/base/chrome_unit_test_suite.h" | 5 #include "chrome/test/base/chrome_unit_test_suite.h" | 
| 6 | 6 | 
| 7 #include "base/macros.h" | 7 #include "base/macros.h" | 
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" | 
| 9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" | 
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" | 
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" | 
| 12 #include "chrome/browser/chrome_content_browser_client.h" | 12 #include "chrome/browser/chrome_content_browser_client.h" | 
| 13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 
| 14 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 14 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" | 
| 15 #include "chrome/common/chrome_content_client.h" | 15 #include "chrome/common/chrome_content_client.h" | 
| 16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" | 
| 17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" | 
| 18 #include "chrome/utility/chrome_content_utility_client.h" | 18 #include "chrome/utility/chrome_content_utility_client.h" | 
| 19 #include "components/component_updater/component_updater_paths.h" | 19 #include "components/component_updater/component_updater_paths.h" | 
| 20 #include "components/update_client/update_query_params.h" | 20 #include "components/update_client/update_query_params.h" | 
| 21 #include "content/public/common/content_paths.h" | 21 #include "content/public/common/content_paths.h" | 
|  | 22 #include "extensions/features/features.h" | 
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" | 
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" | 
| 24 #include "ui/base/resource/resource_handle.h" | 25 #include "ui/base/resource/resource_handle.h" | 
| 25 #include "ui/base/ui_base_paths.h" | 26 #include "ui/base/ui_base_paths.h" | 
| 26 #include "ui/gl/test/gl_surface_test_support.h" | 27 #include "ui/gl/test/gl_surface_test_support.h" | 
| 27 | 28 | 
| 28 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) | 
| 29 #include "chromeos/chromeos_paths.h" | 30 #include "chromeos/chromeos_paths.h" | 
| 30 #endif | 31 #endif | 
| 31 | 32 | 
| 32 #if defined(ENABLE_EXTENSIONS) | 33 #if BUILDFLAG(ENABLE_EXTENSIONS) | 
| 33 #include "chrome/common/extensions/chrome_extensions_client.h" | 34 #include "chrome/common/extensions/chrome_extensions_client.h" | 
| 34 #include "extensions/common/extension_paths.h" | 35 #include "extensions/common/extension_paths.h" | 
| 35 #endif | 36 #endif | 
| 36 | 37 | 
| 37 namespace { | 38 namespace { | 
| 38 | 39 | 
| 39 // Creates a TestingBrowserProcess for each test. | 40 // Creates a TestingBrowserProcess for each test. | 
| 40 class ChromeUnitTestSuiteInitializer : public testing::EmptyTestEventListener { | 41 class ChromeUnitTestSuiteInitializer : public testing::EmptyTestEventListener { | 
| 41  public: | 42  public: | 
| 42   ChromeUnitTestSuiteInitializer() {} | 43   ChromeUnitTestSuiteInitializer() {} | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 127   content::RegisterPathProvider(); | 128   content::RegisterPathProvider(); | 
| 128   ui::RegisterPathProvider(); | 129   ui::RegisterPathProvider(); | 
| 129   component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS, | 130   component_updater::RegisterPathProvider(chrome::DIR_COMPONENTS, | 
| 130                                           chrome::DIR_INTERNAL_PLUGINS, | 131                                           chrome::DIR_INTERNAL_PLUGINS, | 
| 131                                           chrome::DIR_USER_DATA); | 132                                           chrome::DIR_USER_DATA); | 
| 132 | 133 | 
| 133 #if defined(OS_CHROMEOS) | 134 #if defined(OS_CHROMEOS) | 
| 134   chromeos::RegisterPathProvider(); | 135   chromeos::RegisterPathProvider(); | 
| 135 #endif | 136 #endif | 
| 136 | 137 | 
| 137 #if defined(ENABLE_EXTENSIONS) | 138 #if BUILDFLAG(ENABLE_EXTENSIONS) | 
| 138   extensions::RegisterPathProvider(); | 139   extensions::RegisterPathProvider(); | 
| 139 | 140 | 
| 140   extensions::ExtensionsClient::Set( | 141   extensions::ExtensionsClient::Set( | 
| 141       extensions::ChromeExtensionsClient::GetInstance()); | 142       extensions::ChromeExtensionsClient::GetInstance()); | 
| 142 #endif | 143 #endif | 
| 143 | 144 | 
| 144   content::WebUIControllerFactory::RegisterFactory( | 145   content::WebUIControllerFactory::RegisterFactory( | 
| 145       ChromeWebUIControllerFactory::GetInstance()); | 146       ChromeWebUIControllerFactory::GetInstance()); | 
| 146 | 147 | 
| 147   gl::GLSurfaceTestSupport::InitializeOneOff(); | 148   gl::GLSurfaceTestSupport::InitializeOneOff(); | 
| 148 | 149 | 
| 149   update_client::UpdateQueryParams::SetDelegate( | 150   update_client::UpdateQueryParams::SetDelegate( | 
| 150       ChromeUpdateQueryParamsDelegate::GetInstance()); | 151       ChromeUpdateQueryParamsDelegate::GetInstance()); | 
| 151 } | 152 } | 
| 152 | 153 | 
| 153 void ChromeUnitTestSuite::InitializeResourceBundle() { | 154 void ChromeUnitTestSuite::InitializeResourceBundle() { | 
| 154   // Force unittests to run using en-US so if we test against string | 155   // Force unittests to run using en-US so if we test against string | 
| 155   // output, it'll pass regardless of the system language. | 156   // output, it'll pass regardless of the system language. | 
| 156   ui::ResourceBundle::InitSharedInstanceWithLocale( | 157   ui::ResourceBundle::InitSharedInstanceWithLocale( | 
| 157       "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 158       "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 
| 158   base::FilePath resources_pack_path; | 159   base::FilePath resources_pack_path; | 
| 159   PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 160   PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 
| 160   ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 161   ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 
| 161       resources_pack_path, ui::SCALE_FACTOR_NONE); | 162       resources_pack_path, ui::SCALE_FACTOR_NONE); | 
| 162 } | 163 } | 
| OLD | NEW | 
|---|