def testRepeatableScrollActionNoRepeatsZoomed(self): if not page_action.IsGestureSourceTypeSupported(self._tab, 'touch'): self.skipText('touch gestures not supported') self._tab.action_runner.PinchPage(scale_factor=0.1) inner_height = self._tab.EvaluateJavaScript('window.innerHeight') outer_height = self._tab.EvaluateJavaScript('window.outerHeight') self.assertGreater(inner_height, outer_height) i = repeatable_scroll.RepeatableScrollAction( y_scroll_distance_ratio=0.5) i.WillRunAction(self._tab) i.RunAction(self._tab)
def testRepeatableScrollActionTwoRepeats(self): expected_scroll = ((self._window_height / 2) - 1) * 3 i = repeatable_scroll.RepeatableScrollAction( y_scroll_distance_ratio=0.5, repeat_count=2, repeat_delay_ms=1) i.WillRunAction(self._tab) i.RunAction(self._tab) scroll_position = self._tab.EvaluateJavaScript( 'document.scrollingElement.scrollTop') # We can only expect the final scroll position to be approximatly equal. self.assertTrue(abs(scroll_position - expected_scroll) < 20, msg='scroll_position=%d;expected %d' % (scroll_position, expected_scroll))
def testRepeatableScrollActionNoRepeatsZoomed(self): if (not self._browser_info.HasRepeatableSynthesizeScrollGesture() or not page_action.IsGestureSourceTypeSupported(self._tab, 'touch')): return self._tab.action_runner.PinchPage(scale_factor=0.1) inner_height = self._tab.EvaluateJavaScript('window.innerHeight') outer_height = self._tab.EvaluateJavaScript('window.outerHeight') self.assertGreater(inner_height, outer_height) i = repeatable_scroll.RepeatableScrollAction(y_scroll_distance_ratio=0.5) i.WillRunAction(self._tab) i.RunAction(self._tab)
def testRepeatableScrollActionNoRepeats(self): if not self._browser_info.HasRepeatableSynthesizeScrollGesture(): return expected_scroll = (self._window_height / 2) - 1 i = repeatable_scroll.RepeatableScrollAction(y_scroll_distance_ratio=0.5) i.WillRunAction(self._tab) i.RunAction(self._tab) scroll_position = self._tab.EvaluateJavaScript( '(document.documentElement.scrollTop || document.body.scrollTop)') # We can only expect the final scroll position to be approximatly equal. self.assertTrue(abs(scroll_position - expected_scroll) < 20, msg='scroll_position=%d;expected %d' % (scroll_position, expected_scroll))
def testRepeatableScrollActionNoRepeats(self): expected_scroll = (self._window_height / 2) - 1 self.assertLess( expected_scroll, self._available_scroll, msg='cannot run test because available scroll is too low.' ' Available:%d; Expected:%d' % (self._available_scroll, expected_scroll)) i = repeatable_scroll.RepeatableScrollAction( y_scroll_distance_ratio=0.5) i.WillRunAction(self._tab) i.RunAction(self._tab) scroll_position = self._tab.EvaluateJavaScript( 'document.scrollingElement.scrollTop') # We can only expect the final scroll position to be approximatly equal. self.assertTrue(abs(scroll_position - expected_scroll) < 20, msg='scroll_position=%d;expected %d' % (scroll_position, expected_scroll))