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

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

Issue 8395043: Fix up compositor mocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deeper down the rabbit hole. Created 9 years, 1 month 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') | content/content_plugin.gypi » ('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) 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"
11 #include "base/metrics/stats_table.h" 11 #include "base/metrics/stats_table.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chrome_content_browser_client.h" 17 #include "chrome/browser/chrome_content_browser_client.h"
18 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_content_client.h" 19 #include "chrome/common/chrome_content_client.h"
20 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "chrome/test/base/testing_browser_process.h" 22 #include "chrome/test/base/testing_browser_process.h"
23 #include "content/public/common/content_paths.h" 23 #include "content/public/common/content_paths.h"
24 #include "net/base/mock_host_resolver.h" 24 #include "net/base/mock_host_resolver.h"
25 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
26 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/base/ui_base_paths.h" 29 #include "ui/base/ui_base_paths.h"
30 #include "ui/gfx/compositor/compositor_test_support.h" 30 #include "ui/gfx/test/gfx_test_utils.h"
31 31
32 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
33 #include "base/mac/mac_util.h" 33 #include "base/mac/mac_util.h"
34 #include "content/common/chrome_application_mac.h" 34 #include "content/common/chrome_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
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Force unittests to run using en-US so if we test against string 187 // Force unittests to run using en-US so if we test against string
188 // output, it'll pass regardless of the system language. 188 // output, it'll pass regardless of the system language.
189 ResourceBundle::InitSharedInstance("en-US"); 189 ResourceBundle::InitSharedInstance("en-US");
190 FilePath resources_pack_path; 190 FilePath resources_pack_path;
191 PathService::Get(base::DIR_MODULE, &resources_pack_path); 191 PathService::Get(base::DIR_MODULE, &resources_pack_path);
192 resources_pack_path = 192 resources_pack_path =
193 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); 193 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak"));
194 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 194 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
195 195
196 // Mock out the compositor on platforms that use it. 196 // Mock out the compositor on platforms that use it.
197 ui::CompositorTestSupport::SetupMockCompositor(); 197 ui::gfx_test_utils::SetupTestCompositor();
198 198
199 stats_filename_ = base::StringPrintf("unit_tests-%d", 199 stats_filename_ = base::StringPrintf("unit_tests-%d",
200 base::GetCurrentProcId()); 200 base::GetCurrentProcId());
201 RemoveSharedMemoryFile(stats_filename_); 201 RemoveSharedMemoryFile(stats_filename_);
202 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200)); 202 stats_table_.reset(new base::StatsTable(stats_filename_, 20, 200));
203 base::StatsTable::set_current(stats_table_.get()); 203 base::StatsTable::set_current(stats_table_.get());
204 204
205 testing::TestEventListeners& listeners = 205 testing::TestEventListeners& listeners =
206 testing::UnitTest::GetInstance()->listeners(); 206 testing::UnitTest::GetInstance()->listeners();
207 listeners.Append(new ChromeTestSuiteInitializer); 207 listeners.Append(new ChromeTestSuiteInitializer);
208 } 208 }
209 209
210 void ChromeTestSuite::Shutdown() { 210 void ChromeTestSuite::Shutdown() {
211 ResourceBundle::CleanupSharedInstance(); 211 ResourceBundle::CleanupSharedInstance();
212 212
213 #if defined(OS_MACOSX) 213 #if defined(OS_MACOSX)
214 base::mac::SetOverrideAppBundle(NULL); 214 base::mac::SetOverrideAppBundle(NULL);
215 #endif 215 #endif
216 216
217 base::StatsTable::set_current(NULL); 217 base::StatsTable::set_current(NULL);
218 stats_table_.reset(); 218 stats_table_.reset();
219 RemoveSharedMemoryFile(stats_filename_); 219 RemoveSharedMemoryFile(stats_filename_);
220 220
221 base::TestSuite::Shutdown(); 221 base::TestSuite::Shutdown();
222 } 222 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | content/content_plugin.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698