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" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
16 #include "chrome/common/chrome_content_client.h" | 16 #include "chrome/common/chrome_content_client.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "chrome/test/testing_browser_process.h" | 19 #include "chrome/test/testing_browser_process.h" |
20 #include "content/common/content_paths.h" | 20 #include "content/common/content_paths.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 #include "ui/base/ui_base_paths.h" | 23 #include "ui/base/ui_base_paths.h" |
| 24 #if defined(TOOLKIT_VIEWS) |
| 25 #include "views/view.h" |
| 26 #endif |
24 | 27 |
25 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
26 #include "base/mac/mac_util.h" | 29 #include "base/mac/mac_util.h" |
27 #include "content/common/chrome_application_mac.h" | 30 #include "content/common/chrome_application_mac.h" |
28 #endif | 31 #endif |
29 | 32 |
30 #if defined(OS_POSIX) | 33 #if defined(OS_POSIX) |
31 #include "base/shared_memory.h" | 34 #include "base/shared_memory.h" |
32 #endif | 35 #endif |
33 | 36 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); | 137 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); |
135 | 138 |
136 // initialize the global StatsTable for unit_tests (make sure the file | 139 // initialize the global StatsTable for unit_tests (make sure the file |
137 // 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) |
138 stats_filename_ = "unit_tests"; | 141 stats_filename_ = "unit_tests"; |
139 std::string pid_string = base::StringPrintf("-%d", base::GetCurrentProcId()); | 142 std::string pid_string = base::StringPrintf("-%d", base::GetCurrentProcId()); |
140 stats_filename_ += pid_string; | 143 stats_filename_ += pid_string; |
141 RemoveSharedMemoryFile(stats_filename_); | 144 RemoveSharedMemoryFile(stats_filename_); |
142 stats_table_ = new base::StatsTable(stats_filename_, 20, 200); | 145 stats_table_ = new base::StatsTable(stats_filename_, 20, 200); |
143 base::StatsTable::set_current(stats_table_); | 146 base::StatsTable::set_current(stats_table_); |
| 147 |
| 148 #if defined(TOUCH_UI) |
| 149 // Turn of GPU compositing in browser during unit tests. |
| 150 views::View::set_use_acceleration_when_possible(false); |
| 151 #endif |
144 } | 152 } |
145 | 153 |
146 void ChromeTestSuite::Shutdown() { | 154 void ChromeTestSuite::Shutdown() { |
147 ResourceBundle::CleanupSharedInstance(); | 155 ResourceBundle::CleanupSharedInstance(); |
148 | 156 |
149 #if defined(OS_MACOSX) | 157 #if defined(OS_MACOSX) |
150 base::mac::SetOverrideAppBundle(NULL); | 158 base::mac::SetOverrideAppBundle(NULL); |
151 #endif | 159 #endif |
152 | 160 |
153 delete g_browser_process; | 161 delete g_browser_process; |
154 g_browser_process = NULL; | 162 g_browser_process = NULL; |
155 | 163 |
156 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 164 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
157 base::StatsTable::set_current(NULL); | 165 base::StatsTable::set_current(NULL); |
158 delete stats_table_; | 166 delete stats_table_; |
159 RemoveSharedMemoryFile(stats_filename_); | 167 RemoveSharedMemoryFile(stats_filename_); |
160 | 168 |
161 base::TestSuite::Shutdown(); | 169 base::TestSuite::Shutdown(); |
162 } | 170 } |
OLD | NEW |