diff options
author | ykyyip@chromium.org <ykyyip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-29 20:07:49 +0000 |
---|---|---|
committer | ykyyip@chromium.org <ykyyip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-29 20:07:49 +0000 |
commit | 20b214459fa989221db03f6fc96e4f13633c1e6a (patch) | |
tree | b2c8e232ae0cce849433ff27a1b4f03c477f47ff | |
parent | 4d636e75b6bee9f4bef023d78f8a65d075e6be22 (diff) | |
download | chromium_src-20b214459fa989221db03f6fc96e4f13633c1e6a.zip chromium_src-20b214459fa989221db03f6fc96e4f13633c1e6a.tar.gz chromium_src-20b214459fa989221db03f6fc96e4f13633c1e6a.tar.bz2 |
copy the pica benchmark to polymer_load
Rename the pica benchmark to something more generic
to reuse with other page sets. The pica benchmark
will be removed after it's also renamed in the
perf bot.
R=dtu@chromium.org,adamk@chromium.org,tonyg@chromium.org
NOTRY=true
Review URL: https://codereview.chromium.org/255063002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266943 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | tools/perf/benchmarks/pica.py | 2 | ||||
-rw-r--r-- | tools/perf/benchmarks/polymer_load.py | 13 | ||||
-rw-r--r-- | tools/perf/measurements/polymer_load.py | 37 | ||||
-rw-r--r-- | tools/perf/page_sets/pica.py | 16 |
4 files changed, 53 insertions, 15 deletions
diff --git a/tools/perf/benchmarks/pica.py b/tools/perf/benchmarks/pica.py index 98b316e..f5cef99 100644 --- a/tools/perf/benchmarks/pica.py +++ b/tools/perf/benchmarks/pica.py @@ -12,7 +12,7 @@ class _PicaMeasurement(page_measurement.PageMeasurement): '--enable-experimental-web-platform-features') def MeasurePage(self, _, tab, results): - result = int(tab.EvaluateJavaScript('__pica_load_time')) + result = int(tab.EvaluateJavaScript('__polymer_ready_time')) results.Add('Total', 'ms', result) diff --git a/tools/perf/benchmarks/polymer_load.py b/tools/perf/benchmarks/polymer_load.py new file mode 100644 index 0000000..d062b9f --- /dev/null +++ b/tools/perf/benchmarks/polymer_load.py @@ -0,0 +1,13 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from measurements import polymer_load +from telemetry import test + + +class PolymerLoadPica(test.Test): + """Measures time to polymer-ready for PICA + """ + test = polymer_load.PolymerLoadMeasurement + page_set = 'page_sets/pica.py' diff --git a/tools/perf/measurements/polymer_load.py b/tools/perf/measurements/polymer_load.py new file mode 100644 index 0000000..d7edf3d --- /dev/null +++ b/tools/perf/measurements/polymer_load.py @@ -0,0 +1,37 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from telemetry.page.actions.all_page_actions import NavigateAction, WaitAction +from telemetry.page import page +from telemetry.page import page_measurement + + +class PageForPolymerLoad(page.PageWithDefaultRunNavigate): + + def __init__(self, url, page_set): + super(PageForPolymerLoad, self).__init__( + url=url, + page_set=page_set) + self.script_to_evaluate_on_commit = ''' + document.addEventListener("polymer-ready", function() { + var unused = document.body.offsetHeight; + window.__polymer_ready_time = performance.now(); + setTimeout(function() { + window.__polymer_ready = true; + }, 1000); + }) + ''' + + def RunNavigateSteps(self, action_runner): + action_runner.RunAction(NavigateAction()) + action_runner.RunAction(WaitAction( + { + 'javascript': "window.__polymer_ready" + })) + + +class PolymerLoadMeasurement(page_measurement.PageMeasurement): + def MeasurePage(self, _, tab, results): + result = int(tab.EvaluateJavaScript('__polymer_ready_time')) + results.Add('Total', 'ms', result) diff --git a/tools/perf/page_sets/pica.py b/tools/perf/page_sets/pica.py index cc4867a..6ddaebd 100644 --- a/tools/perf/page_sets/pica.py +++ b/tools/perf/page_sets/pica.py @@ -5,28 +5,16 @@ from telemetry.page.actions.all_page_actions import * from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module +from measurements import polymer_load -class PicaPage(page_module.PageWithDefaultRunNavigate): +class PicaPage(polymer_load.PageForPolymerLoad): def __init__(self, page_set): super(PicaPage, self).__init__( url='http://localhost/polymer/projects/pica/', page_set=page_set) self.archive_data_file = 'data/pica.json' - self.script_to_evaluate_on_commit = ''' - document.addEventListener('polymer-ready', function() { - var unused = document.body.offsetHeight; - window.__pica_load_time = performance.now(); - setTimeout(function(){window.__polymer_ready=true}, 1000) - })''' - - def RunNavigateSteps(self, action_runner): - action_runner.RunAction(NavigateAction()) - action_runner.RunAction(WaitAction( - { - 'javascript': 'window.__polymer_ready' - })) class PicaPageSet(page_set_module.PageSet): |