OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/mac/scoped_nsautorelease_pool.h" | |
10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
11 #include "base/metrics/stats_table.h" | 10 #include "base/metrics/stats_table.h" |
12 #include "base/path_service.h" | 11 #include "base/path_service.h" |
13 #include "base/process_util.h" | 12 #include "base/process_util.h" |
14 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chrome_content_browser_client.h" | 16 #include "chrome/browser/chrome_content_browser_client.h" |
18 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_content_client.h" | 18 #include "chrome/common/chrome_content_client.h" |
20 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
22 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
23 #include "content/public/common/content_paths.h" | 22 #include "content/public/common/content_paths.h" |
24 #include "net/base/mock_host_resolver.h" | 23 #include "net/base/mock_host_resolver.h" |
25 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
26 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
28 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/base/ui_base_paths.h" | 28 #include "ui/base/ui_base_paths.h" |
30 #include "ui/gfx/test/gfx_test_utils.h" | 29 #include "ui/gfx/test/gfx_test_utils.h" |
31 | 30 |
32 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
33 #include "base/mac/mac_util.h" | 32 #include "base/mac/mac_util.h" |
| 33 #include "base/mac/scoped_nsautorelease_pool.h" |
34 #include "content/common/chrome_application_mac.h" | 34 #include "content/common/chrome_application_mac.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(OS_POSIX) | 37 #if defined(OS_POSIX) |
38 #include "base/shared_memory.h" | 38 #include "base/shared_memory.h" |
39 #endif | 39 #endif |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 void RemoveSharedMemoryFile(const std::string& filename) { | 43 void RemoveSharedMemoryFile(const std::string& filename) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ChromeTestSuite::ChromeTestSuite(int argc, char** argv) | 152 ChromeTestSuite::ChromeTestSuite(int argc, char** argv) |
153 : base::TestSuite(argc, argv) { | 153 : base::TestSuite(argc, argv) { |
154 } | 154 } |
155 | 155 |
156 ChromeTestSuite::~ChromeTestSuite() { | 156 ChromeTestSuite::~ChromeTestSuite() { |
157 } | 157 } |
158 | 158 |
159 void ChromeTestSuite::Initialize() { | 159 void ChromeTestSuite::Initialize() { |
160 #if defined(OS_MACOSX) | 160 #if defined(OS_MACOSX) |
161 chrome_application_mac::RegisterCrApp(); | 161 chrome_application_mac::RegisterCrApp(); |
| 162 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
162 #endif | 163 #endif |
163 | 164 |
164 base::mac::ScopedNSAutoreleasePool autorelease_pool; | |
165 | |
166 base::TestSuite::Initialize(); | 165 base::TestSuite::Initialize(); |
167 | 166 |
168 chrome::RegisterChromeSchemes(); | 167 chrome::RegisterChromeSchemes(); |
169 | 168 |
170 chrome::RegisterPathProvider(); | 169 chrome::RegisterPathProvider(); |
171 content::RegisterPathProvider(); | 170 content::RegisterPathProvider(); |
172 ui::RegisterPathProvider(); | 171 ui::RegisterPathProvider(); |
173 | 172 |
174 if (!browser_dir_.empty()) { | 173 if (!browser_dir_.empty()) { |
175 PathService::Override(base::DIR_EXE, browser_dir_); | 174 PathService::Override(base::DIR_EXE, browser_dir_); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 #if defined(OS_MACOSX) | 212 #if defined(OS_MACOSX) |
214 base::mac::SetOverrideAppBundle(NULL); | 213 base::mac::SetOverrideAppBundle(NULL); |
215 #endif | 214 #endif |
216 | 215 |
217 base::StatsTable::set_current(NULL); | 216 base::StatsTable::set_current(NULL); |
218 stats_table_.reset(); | 217 stats_table_.reset(); |
219 RemoveSharedMemoryFile(stats_filename_); | 218 RemoveSharedMemoryFile(stats_filename_); |
220 | 219 |
221 base::TestSuite::Shutdown(); | 220 base::TestSuite::Shutdown(); |
222 } | 221 } |
OLD | NEW |