summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorwiltzius@chromium.org <wiltzius@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-15 18:05:53 +0000
committerwiltzius@chromium.org <wiltzius@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-15 18:05:53 +0000
commit71c927895d02e08f7ead84c62ce321fe503fd9e2 (patch)
tree9ad8485a87847f0ae5a1acc77d1ca5e8e0ad6c7b /tools
parentaaea077642956e0ef53be32bfdbc7758404c885a (diff)
downloadchromium_src-71c927895d02e08f7ead84c62ce321fe503fd9e2.zip
chromium_src-71c927895d02e08f7ead84c62ce321fe503fd9e2.tar.gz
chromium_src-71c927895d02e08f7ead84c62ce321fe503fd9e2.tar.bz2
First pass at a page set for the Polymer widgets.
Note that this deliberately used the full embedding of the Polymer Paper Sampler, rather than individual pages, because the DOM is larger & more complex which brings out more of our perf issues. Each widget page is still an individual page in the page set, though. The approach is to mostly-automatically interact with every widget on each subpage in the sampler. Still todo are the input subpage and the shadows subpage, but I'd like to get a basic version sanity checked and submitted first. BUG=333078 Review URL: https://codereview.chromium.org/376613002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/page_sets/data/polymer.json13
-rw-r--r--tools/perf/page_sets/data/polymer_003.wpr.sha11
-rw-r--r--tools/perf/page_sets/data/polymer_004.wpr.sha11
-rw-r--r--tools/perf/page_sets/polymer.py113
4 files changed, 123 insertions, 5 deletions
diff --git a/tools/perf/page_sets/data/polymer.json b/tools/perf/page_sets/data/polymer.json
index 283eaaf..5650b26 100644
--- a/tools/perf/page_sets/data/polymer.json
+++ b/tools/perf/page_sets/data/polymer.json
@@ -4,6 +4,19 @@
"polymer_002.wpr": [
"http://localhost:8000/components/paper-calculator/demo.html",
"http://localhost:8000/components/paper-shadow/demo.html"
+ ],
+ "polymer_004.wpr": [
+ "http://www.polymer-project.org/components/paper-calculator/demo.html",
+ "http://www.polymer-project.org/components/paper-shadow/demo.html",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-toggle-button",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-button",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-checkbox",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-icon-button",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-radio-button",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-tabs",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-fab",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#paper-shadow",
+ "http://www.polymer-project.org/components/paper-elements/demo.html#core-scroll-header-panel"
]
}
} \ No newline at end of file
diff --git a/tools/perf/page_sets/data/polymer_003.wpr.sha1 b/tools/perf/page_sets/data/polymer_003.wpr.sha1
new file mode 100644
index 0000000..b2cee95
--- /dev/null
+++ b/tools/perf/page_sets/data/polymer_003.wpr.sha1
@@ -0,0 +1 @@
+b0f5d66540b4964dbcc5971644e9ef18c005cae9 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/polymer_004.wpr.sha1 b/tools/perf/page_sets/data/polymer_004.wpr.sha1
new file mode 100644
index 0000000..aab0740
--- /dev/null
+++ b/tools/perf/page_sets/data/polymer_004.wpr.sha1
@@ -0,0 +1 @@
+16c7cbf3d5d011d692be65d512624859dfb0f8ad \ No newline at end of file
diff --git a/tools/perf/page_sets/polymer.py b/tools/perf/page_sets/polymer.py
index 5952d5a..aaa4043 100644
--- a/tools/perf/page_sets/polymer.py
+++ b/tools/perf/page_sets/polymer.py
@@ -10,7 +10,6 @@ class PolymerPage(page_module.Page):
super(PolymerPage, self).__init__(
url=url,
page_set=page_set)
- self.archive_data_file = "data/polymer.json"
self.script_to_evaluate_on_commit = '''
document.addEventListener("polymer-ready", function() {
window.__polymer_ready = true;
@@ -27,7 +26,8 @@ class PolymerCalculatorPage(PolymerPage):
def __init__(self, page_set):
super(PolymerCalculatorPage, self).__init__(
- url='http://localhost:8000/components/paper-calculator/demo.html',
+ url=('http://www.polymer-project.org/components/paper-calculator/'
+ 'demo.html'),
page_set=page_set)
def RunSmoothness(self, action_runner):
@@ -72,9 +72,8 @@ class PolymerShadowPage(PolymerPage):
def __init__(self, page_set):
super(PolymerShadowPage, self).__init__(
- url='http://localhost:8000/components/paper-shadow/demo.html',
+ url='http://www.polymer-project.org/components/paper-shadow/demo.html',
page_set=page_set)
- self.archive_data_file = 'data/polymer.json'
def RunSmoothness(self, action_runner):
action_runner.ExecuteJavaScript(
@@ -90,13 +89,117 @@ class PolymerShadowPage(PolymerPage):
action_runner.Wait(1)
+class PolymerSampler(PolymerPage):
+
+ def __init__(self, page_set, anchor, scrolling_page=False):
+ """Page exercising interactions with a single Paper Sampler subpage.
+
+ Args:
+ page_set: Page set to inforporate this page into.
+ anchor: string indicating which subpage to load (matches the element
+ type that page is displaying)
+ scrolling_page: Whether scrolling the content pane is relevant to this
+ content page or not.
+ """
+ super(PolymerSampler, self).__init__(
+ url=('http://www.polymer-project.org/components/paper-elements/demo.html#'
+ + anchor),
+ page_set=page_set)
+ self.scrolling_page = scrolling_page
+ self.iframe_js = 'document.querySelector("sampler-scaffold").$.frame'
+
+ def RunNavigateSteps(self, action_runner):
+ #FIXME(wiltzius) workaround for crbug.com/391672
+ action_runner.ExecuteJavaScript('window.location.href="about:blank";')
+ super(PolymerSampler, self).RunNavigateSteps(action_runner)
+ #FIXME(wiltzius) this should wait for iframe to load and all load
+ # animations to end
+ action_runner.Wait(5)
+
+ def RunSmoothness(self, action_runner):
+ #TODO(wiltzius) Add interactions for input elements and shadow pages
+ if self.scrolling_page:
+ # Only bother scrolling the page if its been marked as worthwhile
+ self.ScrollContentPane(action_runner)
+ self.TouchEverything(action_runner)
+
+ def ScrollContentPane(self, action_runner):
+ element_function = (self.iframe_js + '.contentDocument.querySelector('
+ '"core-scroll-header-panel").$.mainContainer')
+ interaction = action_runner.BeginInteraction('Scroll_Page', is_smooth=True)
+ action_runner.ScrollElement(use_touch=True,
+ direction='down',
+ distance='900',
+ element_function=element_function)
+ interaction.End()
+ interaction = action_runner.BeginInteraction('Scroll_Page', is_smooth=True)
+ action_runner.ScrollElement(use_touch=True,
+ direction='up',
+ distance='900',
+ element_function=element_function)
+ interaction.End()
+
+ def TouchEverything(self, action_runner):
+ tappable_types = ['paper-toggle-button', 'paper-button', 'paper-checkbox',
+ 'paper-icon-button', 'paper-radio-button', 'paper-tab', 'paper-fab',
+ 'x-shadow']
+ for tappable_type in tappable_types:
+ self.DoActionOnWidgetType(action_runner, tappable_type, self.TapWidget)
+ swipeable_types = ['paper-slider']
+ for swipeable_type in swipeable_types:
+ self.DoActionOnWidgetType(action_runner, swipeable_type, self.SwipeWidget)
+
+ def DoActionOnWidgetType(self, action_runner, widget_type, action_function):
+ # Find all widgets of this type, but skip any that are disabled or are
+ # currently active as they typically don't produce animation frames.
+ element_list_query = (self.iframe_js +
+ ('.contentDocument.querySelectorAll("body %s:not([disabled]):'
+ 'not([active])")' % widget_type))
+ roles_count_query = element_list_query + '.length'
+ for i in range(action_runner.EvaluateJavaScript(roles_count_query)):
+ element_query = element_list_query + ("[%d]" % i)
+ if action_runner.EvaluateJavaScript(
+ element_query + '.offsetParent != null'):
+ # Only try to tap on visible elements (offsetParent != null)
+ action_runner.ExecuteJavaScript(element_query + '.scrollIntoView()')
+ action_runner.Wait(1) # wait for page to settle after scrolling
+ action_function(action_runner, element_query)
+
+ def TapWidget(self, action_runner, element_function):
+ interaction = action_runner.BeginInteraction(
+ 'Tap_Widget', is_smooth=True)
+ action_runner.TapElement(element_function=element_function)
+ action_runner.Wait(1) # wait for e.g. animations on the widget
+ interaction.End()
+
+ def SwipeWidget(self, action_runner, element_function):
+ interaction = action_runner.BeginInteraction(
+ 'Swipe_Widget', is_smooth=True)
+ action_runner.SwipeElement(element_function=element_function,
+ left_start_ratio=0.75,
+ speed_in_pixels_per_second=300)
+ interaction.End()
+
+
class PolymerPageSet(page_set_module.PageSet):
def __init__(self):
super(PolymerPageSet, self).__init__(
user_agent_type='mobile',
archive_data_file='data/polymer.json',
- bucket=page_set_module.INTERNAL_BUCKET)
+ bucket=page_set_module.PUBLIC_BUCKET)
self.AddPage(PolymerCalculatorPage(self))
self.AddPage(PolymerShadowPage(self))
+
+ # Polymer Sampler subpages that are interesting to tap / swipe elements on
+ TAPPABLE_PAGES = ['paper-toggle-button', 'paper-button', 'paper-checkbox',
+ 'paper-icon-button', 'paper-radio-button', 'paper-tabs', 'paper-fab',
+ 'paper-shadow']
+ for p in TAPPABLE_PAGES:
+ self.AddPage(PolymerSampler(self, p))
+
+ # Polymer Sampler subpages that are interesting to scroll
+ SCROLLABLE_PAGES = ['core-scroll-header-panel']
+ for p in SCROLLABLE_PAGES:
+ self.AddPage(PolymerSampler(self, p, scrolling_page=True))