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

Unified Diff: tools/perf/page_sets/polymer.py

Issue 467043003: skip the polymer calculator slide on wide screens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/polymer.py
diff --git a/tools/perf/page_sets/polymer.py b/tools/perf/page_sets/polymer.py
index 2ec270a9af99c7fc1b9b92bd4519246e579350d2..988f8211a0380c1f0db86939b3558edf71cd31cd 100644
--- a/tools/perf/page_sets/polymer.py
+++ b/tools/perf/page_sets/polymer.py
@@ -49,23 +49,30 @@ class PolymerCalculatorPage(PolymerPage):
interaction.End()
def SlidePanel(self, action_runner):
- interaction = action_runner.BeginInteraction(
- 'Action_SwipeAction', is_smooth=True)
- action_runner.SwipeElement(
- left_start_ratio=0.1, top_start_ratio=0.2,
- direction='left', distance=300, speed_in_pixels_per_second=5000,
- element_function='''
- document.querySelector(
- 'body /deep/ #outerPanels'
- ).querySelector(
- '#advanced'
- ).shadowRoot.querySelector(
- '.handle-bar'
- )''')
- action_runner.WaitForJavaScriptCondition('''
- var outer = document.querySelector("body /deep/ #outerPanels");
- outer.opened || outer.wideMode;''')
- interaction.End()
+ # only bother with this interaction if the drawer is hidden
+ opened = action_runner.EvaluateJavaScript('''
+ (function() {
+ var outer = document.querySelector("body /deep/ #outerPanels");
+ return outer.opened || outer.wideMode;
+ }());''')
+ if not opened:
+ interaction = action_runner.BeginInteraction(
+ 'Action_SwipeAction', is_smooth=True)
+ action_runner.SwipeElement(
+ left_start_ratio=0.1, top_start_ratio=0.2,
+ direction='left', distance=300, speed_in_pixels_per_second=5000,
+ element_function='''
+ document.querySelector(
+ 'body /deep/ #outerPanels'
+ ).querySelector(
+ '#advanced'
+ ).shadowRoot.querySelector(
+ '.handle-bar'
+ )''')
+ action_runner.WaitForJavaScriptCondition('''
+ var outer = document.querySelector("body /deep/ #outerPanels");
+ outer.opened || outer.wideMode;''')
+ interaction.End()
class PolymerShadowPage(PolymerPage):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698