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 #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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/metrics/stats_table.h" | 10 #include "base/metrics/stats_table.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 base::mac::SetOverrideFrameworkBundlePath(path); | 192 base::mac::SetOverrideFrameworkBundlePath(path); |
193 #endif | 193 #endif |
194 | 194 |
195 // Force unittests to run using en-US so if we test against string | 195 // Force unittests to run using en-US so if we test against string |
196 // output, it'll pass regardless of the system language. | 196 // output, it'll pass regardless of the system language. |
197 ResourceBundle::InitSharedInstanceWithLocale("en-US"); | 197 ResourceBundle::InitSharedInstanceWithLocale("en-US"); |
198 FilePath resources_pack_path; | 198 FilePath resources_pack_path; |
199 PathService::Get(base::DIR_MODULE, &resources_pack_path); | 199 PathService::Get(base::DIR_MODULE, &resources_pack_path); |
200 resources_pack_path = | 200 resources_pack_path = |
201 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); | 201 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
202 ResourceBundle::GetSharedInstance().AddDataPack(resources_pack_path); | 202 ResourceBundle::GetSharedInstance().AddDataPack(resources_pack_path, 1.0); |
203 | 203 |
204 // Mock out the compositor on platforms that use it. | 204 // Mock out the compositor on platforms that use it. |
205 ui::SetupTestCompositor(); | 205 ui::SetupTestCompositor(); |
206 | 206 |
207 stats_filename_ = base::StringPrintf("unit_tests-%d", | 207 stats_filename_ = base::StringPrintf("unit_tests-%d", |
208 base::GetCurrentProcId()); | 208 base::GetCurrentProcId()); |
209 RemoveSharedMemoryFile(stats_filename_); | 209 RemoveSharedMemoryFile(stats_filename_); |
210 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); | 210 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); |
211 base::StatsTable::set_current(stats_table_.get()); | 211 base::StatsTable::set_current(stats_table_.get()); |
212 | 212 |
213 testing::TestEventListeners& listeners = | 213 testing::TestEventListeners& listeners = |
214 testing::UnitTest::GetInstance()->listeners(); | 214 testing::UnitTest::GetInstance()->listeners(); |
215 listeners.Append(new ChromeTestSuiteInitializer); | 215 listeners.Append(new ChromeTestSuiteInitializer); |
216 } | 216 } |
217 | 217 |
218 void ChromeTestSuite::Shutdown() { | 218 void ChromeTestSuite::Shutdown() { |
219 ResourceBundle::CleanupSharedInstance(); | 219 ResourceBundle::CleanupSharedInstance(); |
220 | 220 |
221 #if defined(OS_MACOSX) | 221 #if defined(OS_MACOSX) |
222 base::mac::SetOverrideFrameworkBundle(NULL); | 222 base::mac::SetOverrideFrameworkBundle(NULL); |
223 #endif | 223 #endif |
224 | 224 |
225 base::StatsTable::set_current(NULL); | 225 base::StatsTable::set_current(NULL); |
226 stats_table_.reset(); | 226 stats_table_.reset(); |
227 RemoveSharedMemoryFile(stats_filename_); | 227 RemoveSharedMemoryFile(stats_filename_); |
228 | 228 |
229 base::TestSuite::Shutdown(); | 229 base::TestSuite::Shutdown(); |
230 } | 230 } |
OLD | NEW |