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

Side by Side Diff: tools/telemetry/telemetry/page/actions/synthetic_delay.py

Issue 68203031: telemetry: Add tough scheduling cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Full test set. Created 7 years, 1 month 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
(Empty)
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
3 # found in the LICENSE file.
4 from telemetry.page.actions import page_action
nduca 2013/11/24 19:22:46 lets put a docstring on this class that explains w
Sami 2013/11/29 19:29:17 Done.
5
6 class SyntheticDelayAction(page_action.PageAction):
7 def __init__(self, attributes=None):
8 super(SyntheticDelayAction, self).__init__(attributes)
9
10 def WillRunAction(self, page, tab):
11 # Fail if browser doesn't support synthetic delays.
12 if not tab.EvaluateJavaScript("""
13 !!(window.chrome &&
14 chrome.gpuBenchmarking &&
15 chrome.gpuBenchmarking.configureSyntheticDelay);"""):
16 raise page_action.PageActionNotSupported(
17 'Synthetic delays not supported for this browser')
18
19 def RunAction(self, page, tab, previous_action):
20 done_callback = 'function() { window.__syntheticDelayActionDone = true; }'
21 target_duration = float(getattr(self, 'target_duration', '0'))
22 mode = getattr(self, 'mode', 'static')
23 tab.ExecuteJavaScript("""
24 window.__syntheticDelayActionDone = false;
25 chrome.gpuBenchmarking.configureSyntheticDelay("%s", %f, "%s", %s);"""
26 % (self.name, target_duration, mode, done_callback))
27 tab.WaitForJavaScriptExpression('window.__syntheticDelayActionDone ', 10)
28
29 def CustomizeBrowserOptions(self, options):
30 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698