Commit c54fdd33 authored by rbyers's avatar rbyers Committed by Commit bot

Provide fallback for scrollingElement in telemetry tests.

document.scrollingElement was added in M44, but apparently the ref build
is currently older than that.  Provide a temporary fallback without
loosing the benefit of https://codereview.chromium.org/1428733002.

CQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect;tryserver.chromium.perf:mac_10_10_perf_bisect;tryserver.chromium.perf:win_perf_bisect;tryserver.chromium.perf:android_nexus5_perf_bisect

BUG=549644

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

Cr-Commit-Position: refs/heads/master@{#357152}
parent 2c32fabc
...@@ -229,7 +229,7 @@ class ActionRunnerTest(tab_test_case.TabTestCase): ...@@ -229,7 +229,7 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
action_runner.ScrollPage(direction='right', left_start_ratio=0.9, action_runner.ScrollPage(direction='right', left_start_ratio=0.9,
distance=100) distance=100)
self.assertTrue(action_runner.EvaluateJavaScript( self.assertTrue(action_runner.EvaluateJavaScript(
'document.scrollingElement.scrollLeft') > 75) '(document.scrollingElement || document.body).scrollLeft') > 75)
@decorators.Disabled('android', # crbug.com/437065. @decorators.Disabled('android', # crbug.com/437065.
'chromeos') # crbug.com/483212. 'chromeos') # crbug.com/483212.
...@@ -253,7 +253,7 @@ class ActionRunnerTest(tab_test_case.TabTestCase): ...@@ -253,7 +253,7 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
action_runner.SwipePage(direction='left', left_start_ratio=0.9) action_runner.SwipePage(direction='left', left_start_ratio=0.9)
self.assertTrue(action_runner.EvaluateJavaScript( self.assertTrue(action_runner.EvaluateJavaScript(
'document.scrollingElement.scrollLeft') > 75) '(document.scrollingElement || document.body).scrollLeft') > 75)
class InteractionTest(unittest.TestCase): class InteractionTest(unittest.TestCase):
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
this.speed_ = opt_options.speed; this.speed_ = opt_options.speed;
this.gesture_source_type_ = opt_options.gesture_source_type; this.gesture_source_type_ = opt_options.gesture_source_type;
} else { } else {
this.element_ = document.scrollingElement; this.element_ = document.scrollingElement || document.body;
this.left_start_ratio_ = 0.5; this.left_start_ratio_ = 0.5;
this.top_start_ratio_ = 0.5; this.top_start_ratio_ = 0.5;
this.direction_ = 'down'; this.direction_ = 'down';
......
...@@ -78,7 +78,7 @@ class ScrollAction(page_action.PageAction): ...@@ -78,7 +78,7 @@ class ScrollAction(page_action.PageAction):
def RunAction(self, tab): def RunAction(self, tab):
if (self._selector is None and self._text is None and if (self._selector is None and self._text is None and
self._element_function is None): self._element_function is None):
self._element_function = 'document.scrollingElement' self._element_function = '(document.scrollingElement || document.body)'
gesture_source_type = self._synthetic_gesture_source gesture_source_type = self._synthetic_gesture_source
if self._use_touch: if self._use_touch:
......
...@@ -38,7 +38,7 @@ class ScrollBounceAction(page_action.PageAction): ...@@ -38,7 +38,7 @@ class ScrollBounceAction(page_action.PageAction):
if (self._selector is None and self._text is None and if (self._selector is None and self._text is None and
self._element_function is None): self._element_function is None):
self._element_function = 'document.scrollingElement' self._element_function = '(document.scrollingElement || document.body)'
def WillRunAction(self, tab): def WillRunAction(self, tab):
for js_file in ['gesture_common.js', 'scroll_bounce.js']: for js_file in ['gesture_common.js', 'scroll_bounce.js']:
......
...@@ -56,7 +56,7 @@ class SwipeAction(page_action.PageAction): ...@@ -56,7 +56,7 @@ class SwipeAction(page_action.PageAction):
def RunAction(self, tab): def RunAction(self, tab):
if (self._selector is None and self._text is None and if (self._selector is None and self._text is None and
self._element_function is None): self._element_function is None):
self._element_function = 'document.scrollingElement' self._element_function = '(document.scrollingElement || document.body)'
code = ''' code = '''
function(element, info) { function(element, info) {
if (!element) { if (!element) {
......
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