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

Side by Side Diff: chrome/test/perf/frame_rate/frame_rate_tests.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/feature_startup_test.cc ('k') | chrome/test/perf/indexeddb_uitest.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 <map> 5 #include <map>
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/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } else { 189 } else {
190 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 190 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
191 tab->NavigateToURL(net::FilePathToFileURL(test_path))); 191 tab->NavigateToURL(net::FilePathToFileURL(test_path)));
192 } 192 }
193 193
194 // Block until initialization completes 194 // Block until initialization completes
195 // If the following assertion fails intermittently, it could be due to a 195 // If the following assertion fails intermittently, it could be due to a
196 // race condition caused by an html redirect. If that is the case, verify 196 // race condition caused by an html redirect. If that is the case, verify
197 // that flag kHasRedirect is enabled for the current test. 197 // that flag kHasRedirect is enabled for the current test.
198 ASSERT_TRUE(WaitUntilJavaScriptCondition( 198 ASSERT_TRUE(WaitUntilJavaScriptCondition(
199 tab, L"", L"window.domAutomationController.send(__initialized);", 199 tab,
200 TestTimeouts::large_test_timeout())); 200 std::wstring(),
201 L"window.domAutomationController.send(__initialized);",
202 TestTimeouts::large_test_timeout()));
201 203
202 if (HasFlag(kForceGpuComposited)) { 204 if (HasFlag(kForceGpuComposited)) {
203 ASSERT_TRUE(tab->NavigateToURLAsync( 205 ASSERT_TRUE(tab->NavigateToURLAsync(
204 GURL("javascript:__make_body_composited();"))); 206 GURL("javascript:__make_body_composited();")));
205 } 207 }
206 208
207 // Start the tests. 209 // Start the tests.
208 ASSERT_TRUE(tab->NavigateToURLAsync(GURL("javascript:__start_all();"))); 210 ASSERT_TRUE(tab->NavigateToURLAsync(GURL("javascript:__start_all();")));
209 211
210 // Block until the tests completes. 212 // Block until the tests completes.
211 ASSERT_TRUE(WaitUntilJavaScriptCondition( 213 ASSERT_TRUE(WaitUntilJavaScriptCondition(
212 tab, L"", L"window.domAutomationController.send(!__running_all);", 214 tab,
215 std::wstring(),
216 L"window.domAutomationController.send(!__running_all);",
213 TestTimeouts::large_test_timeout())); 217 TestTimeouts::large_test_timeout()));
214 218
215 // TODO(jbates): remove this check when ref builds are updated. 219 // TODO(jbates): remove this check when ref builds are updated.
216 if (!HasFlag(kUseReferenceBuild)) { 220 if (!HasFlag(kUseReferenceBuild)) {
217 std::string json_events; 221 std::string json_events;
218 ASSERT_TRUE(automation()->EndTracing(&json_events)); 222 ASSERT_TRUE(automation()->EndTracing(&json_events));
219 223
220 bool did_run_on_gpu = DidRunOnGpu(json_events); 224 bool did_run_on_gpu = DidRunOnGpu(json_events);
221 bool expect_gpu = HasFlag(kUseGpu); 225 bool expect_gpu = HasFlag(kUseGpu);
222 EXPECT_EQ(expect_gpu, did_run_on_gpu); 226 EXPECT_EQ(expect_gpu, did_run_on_gpu);
223 } 227 }
224 228
225 // Read out the results. 229 // Read out the results.
226 std::wstring json; 230 std::wstring json;
227 ASSERT_TRUE(tab->ExecuteAndExtractString( 231 ASSERT_TRUE(tab->ExecuteAndExtractString(
228 L"", 232 std::wstring(),
229 L"window.domAutomationController.send(" 233 L"window.domAutomationController.send("
230 L"JSON.stringify(__calc_results_total()));", 234 L"JSON.stringify(__calc_results_total()));",
231 &json)); 235 &json));
232 236
233 std::map<std::string, std::string> results; 237 std::map<std::string, std::string> results;
234 ASSERT_TRUE(JsonDictionaryToMap(WideToUTF8(json), &results)); 238 ASSERT_TRUE(JsonDictionaryToMap(WideToUTF8(json), &results));
235 239
236 ASSERT_TRUE(results.find("mean") != results.end()); 240 ASSERT_TRUE(results.find("mean") != results.end());
237 ASSERT_TRUE(results.find("sigma") != results.end()); 241 ASSERT_TRUE(results.find("sigma") != results.end());
238 ASSERT_TRUE(results.find("gestures") != results.end()); 242 ASSERT_TRUE(results.find("gestures") != results.end());
239 ASSERT_TRUE(results.find("means") != results.end()); 243 ASSERT_TRUE(results.find("means") != results.end());
240 ASSERT_TRUE(results.find("sigmas") != results.end()); 244 ASSERT_TRUE(results.find("sigmas") != results.end());
241 245
242 std::string trace_name = "interval" + GetSuffixForTestFlags(); 246 std::string trace_name = "interval" + GetSuffixForTestFlags();
243 printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(), 247 printf("GESTURES %s: %s= [%s] [%s] [%s]\n", name.c_str(),
244 trace_name.c_str(), 248 trace_name.c_str(),
245 results["gestures"].c_str(), 249 results["gestures"].c_str(),
246 results["means"].c_str(), 250 results["means"].c_str(),
247 results["sigmas"].c_str()); 251 results["sigmas"].c_str());
248 252
249 std::string mean_and_error = results["mean"] + "," + results["sigma"]; 253 std::string mean_and_error = results["mean"] + "," + results["sigma"];
250 perf_test::PrintResultMeanAndError(name, "", trace_name, mean_and_error, 254 perf_test::PrintResultMeanAndError(name,
251 "milliseconds-per-frame", true); 255 std::string(),
256 trace_name,
257 mean_and_error,
258 "milliseconds-per-frame",
259 true);
252 260
253 // Navigate back to NTP so that we can quit without timing out during the 261 // Navigate back to NTP so that we can quit without timing out during the
254 // wait-for-idle stage in test framework. 262 // wait-for-idle stage in test framework.
255 EXPECT_EQ(tab->GoBack(), AUTOMATION_MSG_NAVIGATION_SUCCESS); 263 EXPECT_EQ(tab->GoBack(), AUTOMATION_MSG_NAVIGATION_SUCCESS);
256 } 264 }
257 }; 265 };
258 266
259 // Must use a different class name to avoid test instantiation conflicts 267 // Must use a different class name to avoid test instantiation conflicts
260 // with FrameRateTest. An alias is good enough. The alias names must match 268 // with FrameRateTest. An alias is good enough. The alias names must match
261 // the pattern FrameRate*Test* for them to get picked up by the test bots. 269 // the pattern FrameRate*Test* for them to get picked up by the test bots.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 kIsGpuCanvasTest | kInternal | kHasRedirect | kUseGpu | kDisableVsync, 318 kIsGpuCanvasTest | kInternal | kHasRedirect | kUseGpu | kDisableVsync,
311 kIsGpuCanvasTest | kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu, 319 kIsGpuCanvasTest | kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu,
312 kIsGpuCanvasTest | kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu | 320 kIsGpuCanvasTest | kUseReferenceBuild | kInternal | kHasRedirect | kUseGpu |
313 kDisableVsync)); 321 kDisableVsync));
314 322
315 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(fireflies) 323 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(fireflies)
316 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(FishIE) 324 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(FishIE)
317 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(speedreading) 325 INTERNAL_FRAME_RATE_TEST_CANVAS_GPU(speedreading)
318 326
319 } // namespace 327 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/perf/feature_startup_test.cc ('k') | chrome/test/perf/indexeddb_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698