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/browser/ui/webui/chrome_web_ui_controller_factory.h" |
23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/chrome_content_client.h" | 24 #include "chrome/common/chrome_content_client.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
| 27 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" |
26 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
27 #include "chrome/test/base/testing_browser_process.h" | 29 #include "chrome/test/base/testing_browser_process.h" |
28 #include "content/public/test/test_launcher.h" | 30 #include "content/public/test/test_launcher.h" |
29 #include "extensions/common/extension_paths.h" | 31 #include "extensions/common/extension_paths.h" |
30 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
31 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
32 #include "net/dns/mock_host_resolver.h" | 34 #include "net/dns/mock_host_resolver.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
34 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/base/resource/resource_handle.h" | 37 #include "ui/base/resource/resource_handle.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 chromeos::RegisterPathProvider(); | 221 chromeos::RegisterPathProvider(); |
220 #endif | 222 #endif |
221 if (!browser_dir_.empty()) { | 223 if (!browser_dir_.empty()) { |
222 PathService::Override(base::DIR_EXE, browser_dir_); | 224 PathService::Override(base::DIR_EXE, browser_dir_); |
223 PathService::Override(base::DIR_MODULE, browser_dir_); | 225 PathService::Override(base::DIR_MODULE, browser_dir_); |
224 } | 226 } |
225 | 227 |
226 #if !defined(OS_IOS) | 228 #if !defined(OS_IOS) |
227 extensions::RegisterPathProvider(); | 229 extensions::RegisterPathProvider(); |
228 | 230 |
| 231 // Only want to do this for unit tests. |
229 if (!content::GetCurrentTestLauncherDelegate()) { | 232 if (!content::GetCurrentTestLauncherDelegate()) { |
230 // Only want to do this for unit tests. For browser tests, this won't create | 233 extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( |
231 // the right object since TestChromeWebUIControllerFactory is used. That's | 234 extensions::ChromeAPIPermissions()); |
232 // created and registered in ChromeBrowserMainParts as in normal startup. | 235 extensions::RegisterChromeManifestHandlers(); |
| 236 |
| 237 // For browser tests, this won't create the right object since |
| 238 // TestChromeWebUIControllerFactory is used. That's created and |
| 239 // registered in ChromeBrowserMainParts as in normal startup. |
233 content::WebUIControllerFactory::RegisterFactory( | 240 content::WebUIControllerFactory::RegisterFactory( |
234 ChromeWebUIControllerFactory::GetInstance()); | 241 ChromeWebUIControllerFactory::GetInstance()); |
235 } | 242 } |
236 #endif | 243 #endif |
237 | 244 |
238 // Disable external libraries load if we are under python process in | 245 // Disable external libraries load if we are under python process in |
239 // ChromeOS. That means we are autotest and, if ASAN is used, | 246 // ChromeOS. That means we are autotest and, if ASAN is used, |
240 // external libraries load crashes. | 247 // external libraries load crashes. |
241 content::ContentTestSuiteBase::set_external_libraries_enabled( | 248 content::ContentTestSuiteBase::set_external_libraries_enabled( |
242 !IsCrosPythonProcess()); | 249 !IsCrosPythonProcess()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 #if defined(OS_MACOSX) && !defined(OS_IOS) | 295 #if defined(OS_MACOSX) && !defined(OS_IOS) |
289 base::mac::SetOverrideFrameworkBundle(NULL); | 296 base::mac::SetOverrideFrameworkBundle(NULL); |
290 #endif | 297 #endif |
291 | 298 |
292 base::StatsTable::set_current(NULL); | 299 base::StatsTable::set_current(NULL); |
293 stats_table_.reset(); | 300 stats_table_.reset(); |
294 RemoveSharedMemoryFile(stats_filename_); | 301 RemoveSharedMemoryFile(stats_filename_); |
295 | 302 |
296 base::TestSuite::Shutdown(); | 303 base::TestSuite::Shutdown(); |
297 } | 304 } |
OLD | NEW |