| 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/unit/chrome_test_suite.h" | 5 #include "chrome/test/unit/chrome_test_suite.h" |
| 6 | 6 |
| 7 #include "app/app_paths.h" | 7 #include "app/app_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/mac/scoped_nsautorelease_pool.h" | 9 #include "base/mac/scoped_nsautorelease_pool.h" |
| 10 #include "base/metrics/stats_table.h" | 10 #include "base/metrics/stats_table.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // initialize the global StatsTable for unit_tests (make sure the file | 139 // initialize the global StatsTable for unit_tests (make sure the file |
| 140 // doesn't exist before opening it so the test gets a clean slate) | 140 // doesn't exist before opening it so the test gets a clean slate) |
| 141 stats_filename_ = "unit_tests"; | 141 stats_filename_ = "unit_tests"; |
| 142 std::string pid_string = base::StringPrintf("-%d", base::GetCurrentProcId()); | 142 std::string pid_string = base::StringPrintf("-%d", base::GetCurrentProcId()); |
| 143 stats_filename_ += pid_string; | 143 stats_filename_ += pid_string; |
| 144 RemoveSharedMemoryFile(stats_filename_); | 144 RemoveSharedMemoryFile(stats_filename_); |
| 145 stats_table_ = new base::StatsTable(stats_filename_, 20, 200); | 145 stats_table_ = new base::StatsTable(stats_filename_, 20, 200); |
| 146 base::StatsTable::set_current(stats_table_); | 146 base::StatsTable::set_current(stats_table_); |
| 147 | 147 |
| 148 #if defined(TOUCH_UI) | 148 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
| 149 // Turn of GPU compositing in browser during unit tests. | 149 // Turn of GPU compositing in browser during unit tests. |
| 150 views::View::set_use_acceleration_when_possible(false); | 150 views::View::set_use_acceleration_when_possible(false); |
| 151 #endif | 151 #endif |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ChromeTestSuite::Shutdown() { | 154 void ChromeTestSuite::Shutdown() { |
| 155 ResourceBundle::CleanupSharedInstance(); | 155 ResourceBundle::CleanupSharedInstance(); |
| 156 | 156 |
| 157 #if defined(OS_MACOSX) | 157 #if defined(OS_MACOSX) |
| 158 base::mac::SetOverrideAppBundle(NULL); | 158 base::mac::SetOverrideAppBundle(NULL); |
| 159 #endif | 159 #endif |
| 160 | 160 |
| 161 delete g_browser_process; | 161 delete g_browser_process; |
| 162 g_browser_process = NULL; | 162 g_browser_process = NULL; |
| 163 | 163 |
| 164 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 164 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
| 165 base::StatsTable::set_current(NULL); | 165 base::StatsTable::set_current(NULL); |
| 166 delete stats_table_; | 166 delete stats_table_; |
| 167 RemoveSharedMemoryFile(stats_filename_); | 167 RemoveSharedMemoryFile(stats_filename_); |
| 168 | 168 |
| 169 base::TestSuite::Shutdown(); | 169 base::TestSuite::Shutdown(); |
| 170 } | 170 } |
| OLD | NEW |