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

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

Issue 9288053: Remove old (pre-webkit) compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 8 years, 11 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 #include "base/mac/bundle_locations.h" 31 #include "base/mac/bundle_locations.h"
32 #include "base/mac/mac_util.h" 32 #include "base/mac/mac_util.h"
33 #include "base/mac/scoped_nsautorelease_pool.h" 33 #include "base/mac/scoped_nsautorelease_pool.h"
34 #include "chrome/browser/chrome_browser_application_mac.h" 34 #include "chrome/browser/chrome_browser_application_mac.h"
35 #endif 35 #endif
36 36
37 #if defined(OS_POSIX) 37 #if defined(OS_POSIX)
38 #include "base/shared_memory.h" 38 #include "base/shared_memory.h"
39 #endif 39 #endif
40 40
41 #if defined(USE_WEBKIT_COMPOSITOR)
42 #include "ui/gfx/compositor/compositor_setup.h" 41 #include "ui/gfx/compositor/compositor_setup.h"
43 #else
44 #include "ui/gfx/test/gfx_test_utils.h"
45 #endif
46 42
47 namespace { 43 namespace {
48 44
49 void RemoveSharedMemoryFile(const std::string& filename) { 45 void RemoveSharedMemoryFile(const std::string& filename) {
50 // Stats uses SharedMemory under the hood. On posix, this results in a file 46 // Stats uses SharedMemory under the hood. On posix, this results in a file
51 // on disk. 47 // on disk.
52 #if defined(OS_POSIX) 48 #if defined(OS_POSIX)
53 base::SharedMemory memory; 49 base::SharedMemory memory;
54 memory.Delete(filename); 50 memory.Delete(filename);
55 #endif 51 #endif
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Force unittests to run using en-US so if we test against string 188 // Force unittests to run using en-US so if we test against string
193 // output, it'll pass regardless of the system language. 189 // output, it'll pass regardless of the system language.
194 ResourceBundle::InitSharedInstance("en-US"); 190 ResourceBundle::InitSharedInstance("en-US");
195 FilePath resources_pack_path; 191 FilePath resources_pack_path;
196 PathService::Get(base::DIR_MODULE, &resources_pack_path); 192 PathService::Get(base::DIR_MODULE, &resources_pack_path);
197 resources_pack_path = 193 resources_pack_path =
198 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); 194 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak"));
199 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 195 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
200 196
201 // Mock out the compositor on platforms that use it. 197 // Mock out the compositor on platforms that use it.
202 #if defined(USE_WEBKIT_COMPOSITOR)
203 ui::SetupTestCompositor(); 198 ui::SetupTestCompositor();
204 #else
205 ui::gfx_test_utils::SetupTestCompositor();
206 #endif
207 199
208 stats_filename_ = base::StringPrintf("unit_tests-%d", 200 stats_filename_ = base::StringPrintf("unit_tests-%d",
209 base::GetCurrentProcId()); 201 base::GetCurrentProcId());
210 RemoveSharedMemoryFile(stats_filename_); 202 RemoveSharedMemoryFile(stats_filename_);
211 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); 203 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200));
212 base::StatsTable::set_current(stats_table_.get()); 204 base::StatsTable::set_current(stats_table_.get());
213 205
214 testing::TestEventListeners& listeners = 206 testing::TestEventListeners& listeners =
215 testing::UnitTest::GetInstance()->listeners(); 207 testing::UnitTest::GetInstance()->listeners();
216 listeners.Append(new ChromeTestSuiteInitializer); 208 listeners.Append(new ChromeTestSuiteInitializer);
217 } 209 }
218 210
219 void ChromeTestSuite::Shutdown() { 211 void ChromeTestSuite::Shutdown() {
220 ResourceBundle::CleanupSharedInstance(); 212 ResourceBundle::CleanupSharedInstance();
221 213
222 #if defined(OS_MACOSX) 214 #if defined(OS_MACOSX)
223 base::mac::SetOverrideFrameworkBundle(NULL); 215 base::mac::SetOverrideFrameworkBundle(NULL);
224 #endif 216 #endif
225 217
226 base::StatsTable::set_current(NULL); 218 base::StatsTable::set_current(NULL);
227 stats_table_.reset(); 219 stats_table_.reset();
228 RemoveSharedMemoryFile(stats_filename_); 220 RemoveSharedMemoryFile(stats_filename_);
229 221
230 base::TestSuite::Shutdown(); 222 base::TestSuite::Shutdown();
231 } 223 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698