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 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (g_browser_process) { | 104 if (g_browser_process) { |
105 BrowserProcess* browser_process = g_browser_process; | 105 BrowserProcess* browser_process = g_browser_process; |
106 // g_browser_process must be NULL during its own destruction. | 106 // g_browser_process must be NULL during its own destruction. |
107 g_browser_process = NULL; | 107 g_browser_process = NULL; |
108 delete browser_process; | 108 delete browser_process; |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 private: | 112 private: |
113 void SetUpContentClients() { | 113 void SetUpContentClients() { |
114 content_client_.reset(new chrome::ChromeContentClient); | 114 content_client_.reset(new ChromeContentClient); |
115 content::SetContentClient(content_client_.get()); | 115 content::SetContentClient(content_client_.get()); |
116 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 116 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
117 #if !defined(OS_IOS) | 117 #if !defined(OS_IOS) |
118 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); | 118 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); |
119 content::SetBrowserClientForTesting(browser_content_client_.get()); | 119 content::SetBrowserClientForTesting(browser_content_client_.get()); |
120 utility_content_client_.reset(new chrome::ChromeContentUtilityClient()); | 120 utility_content_client_.reset(new chrome::ChromeContentUtilityClient()); |
121 content::SetUtilityClientForTesting(utility_content_client_.get()); | 121 content::SetUtilityClientForTesting(utility_content_client_.get()); |
122 #endif | 122 #endif |
123 } | 123 } |
124 | 124 |
(...skipping 12 matching lines...) Expand all Loading... |
137 new extensions::ChromeExtensionsBrowserClient); | 137 new extensions::ChromeExtensionsBrowserClient); |
138 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); | 138 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); |
139 } | 139 } |
140 | 140 |
141 void TearDownExtensionsClients() { | 141 void TearDownExtensionsClients() { |
142 extensions_browser_client_.reset(); | 142 extensions_browser_client_.reset(); |
143 extensions::ExtensionsBrowserClient::Set(NULL); | 143 extensions::ExtensionsBrowserClient::Set(NULL); |
144 } | 144 } |
145 | 145 |
146 // Client implementations for the content module. | 146 // Client implementations for the content module. |
147 scoped_ptr<chrome::ChromeContentClient> content_client_; | 147 scoped_ptr<ChromeContentClient> content_client_; |
148 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. | 148 // TODO(ios): Bring this back once ChromeContentBrowserClient is building. |
149 #if !defined(OS_IOS) | 149 #if !defined(OS_IOS) |
150 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; | 150 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; |
151 scoped_ptr<chrome::ChromeContentUtilityClient> utility_content_client_; | 151 scoped_ptr<chrome::ChromeContentUtilityClient> utility_content_client_; |
152 #endif | 152 #endif |
153 | 153 |
154 // Client implementations for the extensions module. | 154 // Client implementations for the extensions module. |
155 scoped_ptr<extensions::ChromeExtensionsBrowserClient> | 155 scoped_ptr<extensions::ChromeExtensionsBrowserClient> |
156 extensions_browser_client_; | 156 extensions_browser_client_; |
157 | 157 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 RemoveSharedMemoryFile(stats_filename_); | 246 RemoveSharedMemoryFile(stats_filename_); |
247 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); | 247 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); |
248 base::StatsTable::set_current(stats_table_.get()); | 248 base::StatsTable::set_current(stats_table_.get()); |
249 | 249 |
250 testing::TestEventListeners& listeners = | 250 testing::TestEventListeners& listeners = |
251 testing::UnitTest::GetInstance()->listeners(); | 251 testing::UnitTest::GetInstance()->listeners(); |
252 listeners.Append(new ChromeTestSuiteInitializer); | 252 listeners.Append(new ChromeTestSuiteInitializer); |
253 } | 253 } |
254 | 254 |
255 content::ContentClient* ChromeTestSuite::CreateClientForInitialization() { | 255 content::ContentClient* ChromeTestSuite::CreateClientForInitialization() { |
256 return new chrome::ChromeContentClient(); | 256 return new ChromeContentClient(); |
257 } | 257 } |
258 | 258 |
259 void ChromeTestSuite::Shutdown() { | 259 void ChromeTestSuite::Shutdown() { |
260 ResourceBundle::CleanupSharedInstance(); | 260 ResourceBundle::CleanupSharedInstance(); |
261 | 261 |
262 #if defined(OS_MACOSX) && !defined(OS_IOS) | 262 #if defined(OS_MACOSX) && !defined(OS_IOS) |
263 base::mac::SetOverrideFrameworkBundle(NULL); | 263 base::mac::SetOverrideFrameworkBundle(NULL); |
264 #endif | 264 #endif |
265 | 265 |
266 base::StatsTable::set_current(NULL); | 266 base::StatsTable::set_current(NULL); |
267 stats_table_.reset(); | 267 stats_table_.reset(); |
268 RemoveSharedMemoryFile(stats_filename_); | 268 RemoveSharedMemoryFile(stats_filename_); |
269 | 269 |
270 base::TestSuite::Shutdown(); | 270 base::TestSuite::Shutdown(); |
271 } | 271 } |
OLD | NEW |