Commit f10be06f authored by tonyg@chromium.org's avatar tonyg@chromium.org

[Telemetry] Remove waits in telemetry_perf_unittests.

This reduces cycle time by about 15 seconds and has the desirable property that
it prevents developers from doing anything racy with a Wait. Waits should only
be used for a period of perf measurement like smoothness, energy, etc. They
shouldn't be used to wait for some condition to be true.

BUG=388256

Review URL: https://codereview.chromium.org/473703002

Cr-Commit-Position: refs/heads/master@{#289570}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289570 0039d316-1c4b-4281-b951-d872f2087c98
parent 64d97df4
...@@ -35,7 +35,11 @@ def SmokeTestGenerator(benchmark): ...@@ -35,7 +35,11 @@ def SmokeTestGenerator(benchmark):
def CreatePageSet(self, options): def CreatePageSet(self, options):
# pylint: disable=E1002 # pylint: disable=E1002
ps = super(SinglePageBenchmark, self).CreatePageSet(options) ps = super(SinglePageBenchmark, self).CreatePageSet(options)
ps.pages = ps.pages[:1] for p in ps.pages:
if not p.disabled:
p.skip_waits = True
ps.pages = [p]
break
return ps return ps
# Set the benchmark's default arguments. # Set the benchmark's default arguments.
......
...@@ -35,7 +35,7 @@ class AnimatedPage(page.Page): ...@@ -35,7 +35,7 @@ class AnimatedPage(page.Page):
page_set=page_set, base_dir=page_set.base_dir) page_set=page_set, base_dir=page_set.base_dir)
def RunSmoothness(self, action_runner): def RunSmoothness(self, action_runner):
action_runner.Wait(1) action_runner.Wait(.2)
class FakeTab(object): class FakeTab(object):
......
...@@ -22,8 +22,9 @@ from telemetry.web_perf import timeline_interaction_record ...@@ -22,8 +22,9 @@ from telemetry.web_perf import timeline_interaction_record
class ActionRunner(object): class ActionRunner(object):
def __init__(self, tab): def __init__(self, tab, skip_waits=False):
self._tab = tab self._tab = tab
self._skip_waits = skip_waits
def _RunAction(self, action): def _RunAction(self, action):
action.WillRunAction(self._tab) action.WillRunAction(self._tab)
...@@ -153,7 +154,8 @@ class ActionRunner(object): ...@@ -153,7 +154,8 @@ class ActionRunner(object):
Args: Args:
seconds: The number of seconds to wait. seconds: The number of seconds to wait.
""" """
time.sleep(seconds) if not self._skip_waits:
time.sleep(seconds)
def WaitForJavaScriptCondition(self, condition, timeout_in_seconds=60): def WaitForJavaScriptCondition(self, condition, timeout_in_seconds=60):
"""Wait for a JavaScript condition to become true. """Wait for a JavaScript condition to become true.
......
...@@ -30,6 +30,7 @@ class Page(object): ...@@ -30,6 +30,7 @@ class Page(object):
self.startup_url = page_set.startup_url if page_set else '' self.startup_url = page_set.startup_url if page_set else ''
self.credentials = None self.credentials = None
self.disabled = False self.disabled = False
self.skip_waits = False
self.script_to_evaluate_on_commit = None self.script_to_evaluate_on_commit = None
self._SchemeErrorCheck() self._SchemeErrorCheck()
......
...@@ -297,7 +297,8 @@ class PageTest(command_line.Command): ...@@ -297,7 +297,8 @@ class PageTest(command_line.Command):
def RunPage(self, page, tab, results): def RunPage(self, page, tab, results):
# Run actions. # Run actions.
interactive = self.options and self.options.interactive interactive = self.options and self.options.interactive
action_runner = action_runner_module.ActionRunner(tab) action_runner = action_runner_module.ActionRunner(
tab, skip_waits=page.skip_waits)
self.WillRunActions(page, tab) self.WillRunActions(page, tab)
if interactive: if interactive:
action_runner.PauseInteractive() action_runner.PauseInteractive()
...@@ -317,7 +318,8 @@ class PageTest(command_line.Command): ...@@ -317,7 +318,8 @@ class PageTest(command_line.Command):
Runs the 'navigate_steps' page attribute as a compound action. Runs the 'navigate_steps' page attribute as a compound action.
""" """
action_runner = action_runner_module.ActionRunner(tab) action_runner = action_runner_module.ActionRunner(
tab, skip_waits=page.skip_waits)
page.RunNavigateSteps(action_runner) page.RunNavigateSteps(action_runner)
def IsExiting(self): def IsExiting(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment