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

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

Issue 6708093: Load devtools files from resources.pak rather than from disk take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grd change to force rules to run Created 9 years, 9 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/common/chrome_switches.cc ('k') | chrome/tools/build/win/FILES » ('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/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"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Look in the framework bundle for resources. 119 // Look in the framework bundle for resources.
120 FilePath path; 120 FilePath path;
121 PathService::Get(base::DIR_EXE, &path); 121 PathService::Get(base::DIR_EXE, &path);
122 path = path.Append(chrome::kFrameworkName); 122 path = path.Append(chrome::kFrameworkName);
123 base::mac::SetOverrideAppBundlePath(path); 123 base::mac::SetOverrideAppBundlePath(path);
124 #endif 124 #endif
125 125
126 // Force unittests to run using en-US so if we test against string 126 // Force unittests to run using en-US so if we test against string
127 // output, it'll pass regardless of the system language. 127 // output, it'll pass regardless of the system language.
128 ResourceBundle::InitSharedInstance("en-US"); 128 ResourceBundle::InitSharedInstance("en-US");
129 FilePath resources_pack_path;
130 PathService::Get(base::DIR_MODULE, &resources_pack_path);
131 resources_pack_path =
132 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak"));
133 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
129 134
130 // initialize the global StatsTable for unit_tests (make sure the file 135 // initialize the global StatsTable for unit_tests (make sure the file
131 // doesn't exist before opening it so the test gets a clean slate) 136 // doesn't exist before opening it so the test gets a clean slate)
132 stats_filename_ = "unit_tests"; 137 stats_filename_ = "unit_tests";
133 std::string pid_string = StringPrintf("-%d", base::GetCurrentProcId()); 138 std::string pid_string = StringPrintf("-%d", base::GetCurrentProcId());
134 stats_filename_ += pid_string; 139 stats_filename_ += pid_string;
135 RemoveSharedMemoryFile(stats_filename_); 140 RemoveSharedMemoryFile(stats_filename_);
136 stats_table_ = new base::StatsTable(stats_filename_, 20, 200); 141 stats_table_ = new base::StatsTable(stats_filename_, 20, 200);
137 base::StatsTable::set_current(stats_table_); 142 base::StatsTable::set_current(stats_table_);
138 } 143 }
139 144
140 void ChromeTestSuite::Shutdown() { 145 void ChromeTestSuite::Shutdown() {
141 ResourceBundle::CleanupSharedInstance(); 146 ResourceBundle::CleanupSharedInstance();
142 147
143 #if defined(OS_MACOSX) 148 #if defined(OS_MACOSX)
144 base::mac::SetOverrideAppBundle(NULL); 149 base::mac::SetOverrideAppBundle(NULL);
145 #endif 150 #endif
146 151
147 delete g_browser_process; 152 delete g_browser_process;
148 g_browser_process = NULL; 153 g_browser_process = NULL;
149 154
150 // Tear down shared StatsTable; prevents unit_tests from leaking it. 155 // Tear down shared StatsTable; prevents unit_tests from leaking it.
151 base::StatsTable::set_current(NULL); 156 base::StatsTable::set_current(NULL);
152 delete stats_table_; 157 delete stats_table_;
153 RemoveSharedMemoryFile(stats_filename_); 158 RemoveSharedMemoryFile(stats_filename_);
154 159
155 base::TestSuite::Shutdown(); 160 base::TestSuite::Shutdown();
156 } 161 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/tools/build/win/FILES » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698