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" |
22 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
23 #include "chrome/common/chrome_content_client.h" | 24 #include "chrome/common/chrome_content_client.h" |
24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
26 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
| 28 #include "content/public/test/test_launcher.h" |
27 #include "net/base/mock_host_resolver.h" | 29 #include "net/base/mock_host_resolver.h" |
28 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
29 #include "net/base/net_util.h" | 31 #include "net/base/net_util.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
31 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
32 #include "ui/base/resource/resource_handle.h" | 34 #include "ui/base/resource/resource_handle.h" |
33 | 35 |
34 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
35 #include "base/android/jni_android.h" | 37 #include "base/android/jni_android.h" |
36 #include "chrome/browser/android/chrome_jni_registrar.h" | 38 #include "chrome/browser/android/chrome_jni_registrar.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ui::android::RegisterJni(base::android::AttachCurrentThread()); | 208 ui::android::RegisterJni(base::android::AttachCurrentThread()); |
207 chrome::android::RegisterJni(base::android::AttachCurrentThread()); | 209 chrome::android::RegisterJni(base::android::AttachCurrentThread()); |
208 #endif | 210 #endif |
209 | 211 |
210 chrome::RegisterPathProvider(); | 212 chrome::RegisterPathProvider(); |
211 if (!browser_dir_.empty()) { | 213 if (!browser_dir_.empty()) { |
212 PathService::Override(base::DIR_EXE, browser_dir_); | 214 PathService::Override(base::DIR_EXE, browser_dir_); |
213 PathService::Override(base::DIR_MODULE, browser_dir_); | 215 PathService::Override(base::DIR_MODULE, browser_dir_); |
214 } | 216 } |
215 | 217 |
| 218 #if !defined(OS_IOS) |
| 219 if (!content::GetCurrentTestLauncherDelegate()) { |
| 220 // Only want to do this for unit tests. For browser tests, this won't create |
| 221 // the right object since TestChromeWebUIControllerFactory is used. That's |
| 222 // created and registered in ChromeBrowserMainParts as in normal startup. |
| 223 content::WebUIControllerFactory::RegisterFactory( |
| 224 ChromeWebUIControllerFactory::GetInstance()); |
| 225 } |
| 226 #endif |
| 227 |
216 // Disable external libraries load if we are under python process in | 228 // Disable external libraries load if we are under python process in |
217 // ChromeOS. That means we are autotest and, if ASAN is used, | 229 // ChromeOS. That means we are autotest and, if ASAN is used, |
218 // external libraries load crashes. | 230 // external libraries load crashes. |
219 content::ContentTestSuiteBase::set_external_libraries_enabled( | 231 content::ContentTestSuiteBase::set_external_libraries_enabled( |
220 !IsCrosPythonProcess()); | 232 !IsCrosPythonProcess()); |
221 | 233 |
222 // Initialize after overriding paths as some content paths depend on correct | 234 // Initialize after overriding paths as some content paths depend on correct |
223 // values for DIR_EXE and DIR_MODULE. | 235 // values for DIR_EXE and DIR_MODULE. |
224 content::ContentTestSuiteBase::Initialize(); | 236 content::ContentTestSuiteBase::Initialize(); |
225 | 237 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 #if defined(OS_MACOSX) && !defined(OS_IOS) | 278 #if defined(OS_MACOSX) && !defined(OS_IOS) |
267 base::mac::SetOverrideFrameworkBundle(NULL); | 279 base::mac::SetOverrideFrameworkBundle(NULL); |
268 #endif | 280 #endif |
269 | 281 |
270 base::StatsTable::set_current(NULL); | 282 base::StatsTable::set_current(NULL); |
271 stats_table_.reset(); | 283 stats_table_.reset(); |
272 RemoveSharedMemoryFile(stats_filename_); | 284 RemoveSharedMemoryFile(stats_filename_); |
273 | 285 |
274 base::TestSuite::Shutdown(); | 286 base::TestSuite::Shutdown(); |
275 } | 287 } |
OLD | NEW |