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

Side by Side Diff: chrome/test/perf/page_cycler_test.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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/test/perf/indexeddb_uitest.cc ('k') | chrome/test/perf/perf_test.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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 pages->assign(UTF8ToWide(cookie)); 208 pages->assign(UTF8ToWide(cookie));
209 ASSERT_FALSE(pages->empty()); 209 ASSERT_FALSE(pages->empty());
210 210
211 // Wait for the report.html to be loaded. 211 // Wait for the report.html to be loaded.
212 ASSERT_TRUE(WaitUntilCookieValue( 212 ASSERT_TRUE(WaitUntilCookieValue(
213 tab.get(), test_url, "__navigated_to_report", 213 tab.get(), test_url, "__navigated_to_report",
214 TestTimeouts::action_max_timeout(), "1")); 214 TestTimeouts::action_max_timeout(), "1"));
215 215
216 // Get the timing cookie value from the DOM automation. 216 // Get the timing cookie value from the DOM automation.
217 std::wstring wcookie; 217 std::wstring wcookie;
218 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", 218 ASSERT_TRUE(tab->ExecuteAndExtractString(
219 L"window.domAutomationController.send(" 219 std::wstring(),
220 L"JSON.stringify(__get_timings()));", 220 L"window.domAutomationController.send("
221 &wcookie)); 221 L"JSON.stringify(__get_timings()));",
222 &wcookie));
222 cookie = base::SysWideToNativeMB(wcookie); 223 cookie = base::SysWideToNativeMB(wcookie);
223 224
224 // JSON.stringify() encapsulates the returned string in quotes, strip them. 225 // JSON.stringify() encapsulates the returned string in quotes, strip them.
225 std::string::size_type start_idx = cookie.find("\""); 226 std::string::size_type start_idx = cookie.find("\"");
226 std::string::size_type end_idx = cookie.find_last_of("\""); 227 std::string::size_type end_idx = cookie.find_last_of("\"");
227 if (start_idx != std::string::npos && 228 if (start_idx != std::string::npos &&
228 end_idx != std::string::npos && 229 end_idx != std::string::npos &&
229 start_idx < end_idx) { 230 start_idx < end_idx) {
230 cookie = cookie.substr(start_idx+1, end_idx-start_idx-1); 231 cookie = cookie.substr(start_idx+1, end_idx-start_idx-1);
231 } 232 }
(...skipping 21 matching lines...) Expand all
253 PrintIOPerfInfo(suffix); 254 PrintIOPerfInfo(suffix);
254 perf_test::PrintSystemCommitCharge(suffix, stop_size - start_size, 255 perf_test::PrintSystemCommitCharge(suffix, stop_size - start_size,
255 false /* not important */); 256 false /* not important */);
256 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistograms()); 257 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistograms());
257 } 258 }
258 259
259 std::string trace_name = "t" + std::string(suffix); 260 std::string trace_name = "t" + std::string(suffix);
260 261
261 printf("Pages: [%s]\n", base::SysWideToNativeMB(pages).c_str()); 262 printf("Pages: [%s]\n", base::SysWideToNativeMB(pages).c_str());
262 263
263 perf_test::PrintResultList(graph, "", trace_name, timings, "ms", 264 perf_test::PrintResultList(
264 true /* important */); 265 graph, std::string(), trace_name, timings, "ms", true /* important */);
265 } 266 }
266 267
267 void RunTest(const char* graph, const char* name, bool use_http) { 268 void RunTest(const char* graph, const char* name, bool use_http) {
268 RunTestWithSuffix(graph, name, use_http, ""); 269 RunTestWithSuffix(graph, name, use_http, "");
269 } 270 }
270 271
271 private: 272 private:
272 void PrintMemoryHistogram(const std::string& name, 273 void PrintMemoryHistogram(const std::string& name,
273 const std::string& units) { 274 const std::string& units) {
274 scoped_refptr<TabProxy> tab(GetActiveTab()); 275 scoped_refptr<TabProxy> tab(GetActiveTab());
275 ASSERT_TRUE(tab.get()); 276 ASSERT_TRUE(tab.get());
276 std::wstring whistogram; 277 std::wstring whistogram;
277 ASSERT_TRUE(tab->ExecuteAndExtractString( 278 ASSERT_TRUE(tab->ExecuteAndExtractString(
278 L"", 279 std::wstring(),
279 L"window.domAutomationController.send(" 280 L"window.domAutomationController.send("
280 L"window.domAutomationController.getHistogram ? " 281 L"window.domAutomationController.getHistogram ? "
281 L"window.domAutomationController.getHistogram(\"" + 282 L"window.domAutomationController.getHistogram(\"" +
282 base::SysUTF8ToWide(name) + L"\") : '')", 283 base::SysUTF8ToWide(name) + L"\") : '')",
283 &whistogram)); 284 &whistogram));
284 std::string histogram = base::SysWideToNativeMB(whistogram); 285 std::string histogram = base::SysWideToNativeMB(whistogram);
285 printf("HISTOGRAM %s: %s = %s %s\n", 286 printf("HISTOGRAM %s: %s = %s %s\n",
286 name.c_str(), name.c_str(), histogram.c_str(), units.c_str()); 287 name.c_str(), name.c_str(), histogram.c_str(), units.c_str());
287 } 288 }
288 289
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) { 678 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) {
678 num_test_iterations_ = 1; 679 num_test_iterations_ = 1;
679 RunTest("times", "moz", false); 680 RunTest("times", "moz", false);
680 } 681 }
681 682
682 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) { 683 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) {
683 RunTest("times", "morejs", false); 684 RunTest("times", "morejs", false);
684 } 685 }
685 686
686 } // namespace 687 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/perf/indexeddb_uitest.cc ('k') | chrome/test/perf/perf_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698