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