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/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "components/content_settings/core/common/content_settings_pattern.h" | 20 #include "components/content_settings/core/common/content_settings_pattern.h" |
21 #include "content/public/test/test_launcher.h" | 21 #include "content/public/test/test_launcher.h" |
22 #include "extensions/common/constants.h" | 22 #include "extensions/common/constants.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 #if defined(OS_ANDROID) | |
26 #include "base/android/jni_android.h" | |
27 #include "chrome/browser/android/chrome_jni_registrar.h" | |
28 #include "net/android/net_jni_registrar.h" | |
29 #include "ui/base/android/ui_base_jni_registrar.h" | |
30 #include "ui/gfx/android/gfx_jni_registrar.h" | |
31 #include "ui/gl/android/gl_jni_registrar.h" | |
32 #endif | |
33 | |
34 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
35 #include "base/process/process_metrics.h" | 26 #include "base/process/process_metrics.h" |
36 #include "chromeos/chromeos_paths.h" | 27 #include "chromeos/chromeos_paths.h" |
37 #endif | 28 #endif |
38 | 29 |
39 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
40 #include "base/mac/bundle_locations.h" | 31 #include "base/mac/bundle_locations.h" |
41 #include "base/mac/scoped_nsautorelease_pool.h" | 32 #include "base/mac/scoped_nsautorelease_pool.h" |
42 #if !defined(OS_IOS) | 33 #if !defined(OS_IOS) |
43 #include "chrome/browser/chrome_browser_application_mac.h" | 34 #include "chrome/browser/chrome_browser_application_mac.h" |
(...skipping 30 matching lines...) Expand all Loading... |
74 } | 65 } |
75 | 66 |
76 void ChromeTestSuite::Initialize() { | 67 void ChromeTestSuite::Initialize() { |
77 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
78 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 69 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
79 #if !defined(OS_IOS) | 70 #if !defined(OS_IOS) |
80 chrome_browser_application_mac::RegisterBrowserCrApp(); | 71 chrome_browser_application_mac::RegisterBrowserCrApp(); |
81 #endif // !defined(OS_IOS) | 72 #endif // !defined(OS_IOS) |
82 #endif | 73 #endif |
83 | 74 |
84 #if defined(OS_ANDROID) | |
85 // Register JNI bindings for android. | |
86 gfx::android::RegisterJni(base::android::AttachCurrentThread()); | |
87 net::android::RegisterJni(base::android::AttachCurrentThread()); | |
88 ui::android::RegisterJni(base::android::AttachCurrentThread()); | |
89 ui::gl::android::RegisterJni(base::android::AttachCurrentThread()); | |
90 chrome::android::RegisterJni(base::android::AttachCurrentThread()); | |
91 #endif | |
92 | |
93 if (!browser_dir_.empty()) { | 75 if (!browser_dir_.empty()) { |
94 PathService::Override(base::DIR_EXE, browser_dir_); | 76 PathService::Override(base::DIR_EXE, browser_dir_); |
95 PathService::Override(base::DIR_MODULE, browser_dir_); | 77 PathService::Override(base::DIR_MODULE, browser_dir_); |
96 } | 78 } |
97 | 79 |
98 #if !defined(OS_IOS) | 80 #if !defined(OS_IOS) |
99 // Disable external libraries load if we are under python process in | 81 // Disable external libraries load if we are under python process in |
100 // ChromeOS. That means we are autotest and, if ASAN is used, | 82 // ChromeOS. That means we are autotest and, if ASAN is used, |
101 // external libraries load crashes. | 83 // external libraries load crashes. |
102 if (!IsCrosPythonProcess()) | 84 if (!IsCrosPythonProcess()) |
(...skipping 16 matching lines...) Expand all Loading... |
119 #endif | 101 #endif |
120 } | 102 } |
121 | 103 |
122 void ChromeTestSuite::Shutdown() { | 104 void ChromeTestSuite::Shutdown() { |
123 #if defined(OS_MACOSX) && !defined(OS_IOS) | 105 #if defined(OS_MACOSX) && !defined(OS_IOS) |
124 base::mac::SetOverrideFrameworkBundle(NULL); | 106 base::mac::SetOverrideFrameworkBundle(NULL); |
125 #endif | 107 #endif |
126 | 108 |
127 content::ContentTestSuiteBase::Shutdown(); | 109 content::ContentTestSuiteBase::Shutdown(); |
128 } | 110 } |
OLD | NEW |