Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: chrome/test/base/chrome_test_suite.cc

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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/mac/scoped_nsautorelease_pool.h" 9 #include "base/mac/scoped_nsautorelease_pool.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Force unittests to run using en-US so if we test against string 190 // Force unittests to run using en-US so if we test against string
191 // output, it'll pass regardless of the system language. 191 // output, it'll pass regardless of the system language.
192 ResourceBundle::InitSharedInstance("en-US"); 192 ResourceBundle::InitSharedInstance("en-US");
193 FilePath resources_pack_path; 193 FilePath resources_pack_path;
194 PathService::Get(base::DIR_MODULE, &resources_pack_path); 194 PathService::Get(base::DIR_MODULE, &resources_pack_path);
195 resources_pack_path = 195 resources_pack_path =
196 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); 196 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak"));
197 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 197 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
198 198
199 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX)
200 // Turn of GPU compositing in browser during unit tests.
201 views::View::set_use_acceleration_when_possible(false);
202 #endif
203
204 stats_filename_ = base::StringPrintf("unit_tests-%d", 199 stats_filename_ = base::StringPrintf("unit_tests-%d",
205 base::GetCurrentProcId()); 200 base::GetCurrentProcId());
206 RemoveSharedMemoryFile(stats_filename_); 201 RemoveSharedMemoryFile(stats_filename_);
207 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); 202 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200));
208 base::StatsTable::set_current(stats_table_.get()); 203 base::StatsTable::set_current(stats_table_.get());
209 204
210 testing::TestEventListeners& listeners = 205 testing::TestEventListeners& listeners =
211 testing::UnitTest::GetInstance()->listeners(); 206 testing::UnitTest::GetInstance()->listeners();
212 listeners.Append(new ChromeTestSuiteInitializer); 207 listeners.Append(new ChromeTestSuiteInitializer);
213 } 208 }
214 209
215 void ChromeTestSuite::Shutdown() { 210 void ChromeTestSuite::Shutdown() {
216 ResourceBundle::CleanupSharedInstance(); 211 ResourceBundle::CleanupSharedInstance();
217 212
218 #if defined(OS_MACOSX) 213 #if defined(OS_MACOSX)
219 base::mac::SetOverrideAppBundle(NULL); 214 base::mac::SetOverrideAppBundle(NULL);
220 #endif 215 #endif
221 216
222 base::StatsTable::set_current(NULL); 217 base::StatsTable::set_current(NULL);
223 stats_table_.reset(); 218 stats_table_.reset();
224 RemoveSharedMemoryFile(stats_filename_); 219 RemoveSharedMemoryFile(stats_filename_);
225 220
226 base::TestSuite::Shutdown(); 221 base::TestSuite::Shutdown();
227 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698