| 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/test/base/chrome_test_suite.h" | 5 #include "chrome/test/base/chrome_test_suite.h" |
| 6 | 6 |
| 7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/metrics/stats_table.h" | 15 #include "base/metrics/stats_table.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chrome_content_browser_client.h" | 21 #include "chrome/browser/chrome_content_browser_client.h" |
| 22 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | |
| 23 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/chrome_content_client.h" | 23 #include "chrome/common/chrome_content_client.h" |
| 25 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 27 #include "chrome/test/base/testing_browser_process.h" | 26 #include "chrome/test/base/testing_browser_process.h" |
| 28 #include "content/public/test/test_launcher.h" | |
| 29 #include "net/base/mock_host_resolver.h" | 27 #include "net/base/mock_host_resolver.h" |
| 30 #include "net/base/net_errors.h" | 28 #include "net/base/net_errors.h" |
| 31 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 33 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 34 #include "ui/base/resource/resource_handle.h" | 32 #include "ui/base/resource/resource_handle.h" |
| 35 | 33 |
| 36 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 37 #include "base/android/jni_android.h" | 35 #include "base/android/jni_android.h" |
| 38 #include "chrome/browser/android/chrome_jni_registrar.h" | 36 #include "chrome/browser/android/chrome_jni_registrar.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 net::android::RegisterJni(base::android::AttachCurrentThread()); | 204 net::android::RegisterJni(base::android::AttachCurrentThread()); |
| 207 chrome::android::RegisterJni(base::android::AttachCurrentThread()); | 205 chrome::android::RegisterJni(base::android::AttachCurrentThread()); |
| 208 #endif | 206 #endif |
| 209 | 207 |
| 210 chrome::RegisterPathProvider(); | 208 chrome::RegisterPathProvider(); |
| 211 if (!browser_dir_.empty()) { | 209 if (!browser_dir_.empty()) { |
| 212 PathService::Override(base::DIR_EXE, browser_dir_); | 210 PathService::Override(base::DIR_EXE, browser_dir_); |
| 213 PathService::Override(base::DIR_MODULE, browser_dir_); | 211 PathService::Override(base::DIR_MODULE, browser_dir_); |
| 214 } | 212 } |
| 215 | 213 |
| 216 #if !defined(OS_IOS) | |
| 217 if (!content::GetCurrentTestLauncherDelegate()) { | |
| 218 // Only want to do this for unit tests. For browser tests, this won't create | |
| 219 // the right object since TestChromeWebUIControllerFactory is used. That's | |
| 220 // created and registered in ChromeBrowserMainParts as in normal startup. | |
| 221 content::WebUIControllerFactory::RegisterFactory( | |
| 222 ChromeWebUIControllerFactory::GetInstance()); | |
| 223 } | |
| 224 #endif | |
| 225 | |
| 226 // Disable external libraries load if we are under python process in | 214 // Disable external libraries load if we are under python process in |
| 227 // ChromeOS. That means we are autotest and, if ASAN is used, | 215 // ChromeOS. That means we are autotest and, if ASAN is used, |
| 228 // external libraries load crashes. | 216 // external libraries load crashes. |
| 229 content::ContentTestSuiteBase::set_external_libraries_enabled( | 217 content::ContentTestSuiteBase::set_external_libraries_enabled( |
| 230 !IsCrosPythonProcess()); | 218 !IsCrosPythonProcess()); |
| 231 | 219 |
| 232 // Initialize after overriding paths as some content paths depend on correct | 220 // Initialize after overriding paths as some content paths depend on correct |
| 233 // values for DIR_EXE and DIR_MODULE. | 221 // values for DIR_EXE and DIR_MODULE. |
| 234 content::ContentTestSuiteBase::Initialize(); | 222 content::ContentTestSuiteBase::Initialize(); |
| 235 | 223 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 #if defined(OS_MACOSX) && !defined(OS_IOS) | 260 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 273 base::mac::SetOverrideFrameworkBundle(NULL); | 261 base::mac::SetOverrideFrameworkBundle(NULL); |
| 274 #endif | 262 #endif |
| 275 | 263 |
| 276 base::StatsTable::set_current(NULL); | 264 base::StatsTable::set_current(NULL); |
| 277 stats_table_.reset(); | 265 stats_table_.reset(); |
| 278 RemoveSharedMemoryFile(stats_filename_); | 266 RemoveSharedMemoryFile(stats_filename_); |
| 279 | 267 |
| 280 base::TestSuite::Shutdown(); | 268 base::TestSuite::Shutdown(); |
| 281 } | 269 } |
| OLD | NEW |