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

Side by Side Diff: chrome/test/perf/rendering/throughput_tests.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jar feedback, compile errors Created 8 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
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/run_loop.h"
11 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
12 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
13 #include "base/test/trace_event_analyzer.h" 14 #include "base/test/trace_event_analyzer.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/browser/net/url_fixer_upper.h" 16 #include "chrome/browser/net/url_fixer_upper.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 20 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (use_gpu_) { 189 if (use_gpu_) {
189 command_line->AppendSwitch(switches::kForceCompositingMode); 190 command_line->AppendSwitch(switches::kForceCompositingMode);
190 } else { 191 } else {
191 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); 192 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
192 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); 193 command_line->AppendSwitch(switches::kDisableExperimentalWebGL);
193 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 194 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
194 } 195 }
195 } 196 }
196 197
197 void Wait(int ms) { 198 void Wait(int ms) {
199 base::RunLoop run_loop;
198 MessageLoop::current()->PostDelayedTask( 200 MessageLoop::current()->PostDelayedTask(
199 FROM_HERE, 201 FROM_HERE, run_loop.QuitClosure(),
200 MessageLoop::QuitClosure(),
201 base::TimeDelta::FromMilliseconds(ms)); 202 base::TimeDelta::FromMilliseconds(ms));
202 ui_test_utils::RunMessageLoop(); 203 ui_test_utils::RunThisRunLoop(run_loop.AsWeakPtr());
203 } 204 }
204 205
205 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. 206 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap.
206 bool TabSnapShotToImage(SkBitmap* bitmap) { 207 bool TabSnapShotToImage(SkBitmap* bitmap) {
207 CHECK(bitmap); 208 CHECK(bitmap);
208 std::vector<unsigned char> png; 209 std::vector<unsigned char> png;
209 210
210 gfx::Rect root_bounds = browser()->window()->GetBounds(); 211 gfx::Rect root_bounds = browser()->window()->GetBounds();
211 gfx::Rect tab_contents_bounds; 212 gfx::Rect tab_contents_bounds;
212 browser()->GetActiveWebContents()->GetContainerBounds( 213 browser()->GetActiveWebContents()->GetContainerBounds(
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 559
559 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { 560 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) {
560 RunCanvasBenchTest("many_images", kNone); 561 RunCanvasBenchTest("many_images", kNone);
561 } 562 }
562 563
563 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { 564 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) {
564 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); 565 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
565 } 566 }
566 567
567 } // namespace 568 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698