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

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

Issue 7104039: First draft to enable turning off compositor for unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 | « no previous file | ui/gfx/compositor/compositor_gl.cc » ('j') | views/run_all_unittests.cc » ('J')
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/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 #include "views/view.h"
sky 2011/06/07 23:21:20 Only include this if TOOLKIT_VIEWS is set.
wjmaclean 2011/06/08 13:24:03 Done.
24 25
25 #if defined(OS_MACOSX) 26 #if defined(OS_MACOSX)
26 #include "base/mac/mac_util.h" 27 #include "base/mac/mac_util.h"
27 #include "content/common/chrome_application_mac.h" 28 #include "content/common/chrome_application_mac.h"
28 #endif 29 #endif
29 30
30 #if defined(OS_POSIX) 31 #if defined(OS_POSIX)
31 #include "base/shared_memory.h" 32 #include "base/shared_memory.h"
32 #endif 33 #endif
33 34
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 135 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
135 136
136 // initialize the global StatsTable for unit_tests (make sure the file 137 // 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) 138 // doesn't exist before opening it so the test gets a clean slate)
138 stats_filename_ = "unit_tests"; 139 stats_filename_ = "unit_tests";
139 std::string pid_string = base::StringPrintf("-%d", base::GetCurrentProcId()); 140 std::string pid_string = base::StringPrintf("-%d", base::GetCurrentProcId());
140 stats_filename_ += pid_string; 141 stats_filename_ += pid_string;
141 RemoveSharedMemoryFile(stats_filename_); 142 RemoveSharedMemoryFile(stats_filename_);
142 stats_table_ = new base::StatsTable(stats_filename_, 20, 200); 143 stats_table_ = new base::StatsTable(stats_filename_, 20, 200);
143 base::StatsTable::set_current(stats_table_); 144 base::StatsTable::set_current(stats_table_);
145
146 // Turn of GPU compositing in browser during unit tests.
147 views::View::set_use_acceleration_when_possible(false);
sky 2011/06/07 23:21:20 Only do this if TOUCH_UI.
wjmaclean 2011/06/08 13:24:03 Done. Although, I'm not sure why it isn't TOOLKIT
144 } 148 }
145 149
146 void ChromeTestSuite::Shutdown() { 150 void ChromeTestSuite::Shutdown() {
147 ResourceBundle::CleanupSharedInstance(); 151 ResourceBundle::CleanupSharedInstance();
148 152
149 #if defined(OS_MACOSX) 153 #if defined(OS_MACOSX)
150 base::mac::SetOverrideAppBundle(NULL); 154 base::mac::SetOverrideAppBundle(NULL);
151 #endif 155 #endif
152 156
153 delete g_browser_process; 157 delete g_browser_process;
154 g_browser_process = NULL; 158 g_browser_process = NULL;
155 159
156 // Tear down shared StatsTable; prevents unit_tests from leaking it. 160 // Tear down shared StatsTable; prevents unit_tests from leaking it.
157 base::StatsTable::set_current(NULL); 161 base::StatsTable::set_current(NULL);
158 delete stats_table_; 162 delete stats_table_;
159 RemoveSharedMemoryFile(stats_filename_); 163 RemoveSharedMemoryFile(stats_filename_);
160 164
161 base::TestSuite::Shutdown(); 165 base::TestSuite::Shutdown();
162 } 166 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/compositor/compositor_gl.cc » ('j') | views/run_all_unittests.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698