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

Unified Diff: telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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
Index: telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py
diff --git a/telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py b/telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py
index f5341e9897e1f072e7004c8b5bb832e80bb7a6a0..2c720ec519fb8a4a8229a0412f75ce000c81d122 100644
--- a/telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py
+++ b/telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py
@@ -2,7 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from telemetry import decorators
+
+from telemetry.internal.actions import page_action
from telemetry.internal.actions import repeatable_scroll
+from telemetry.internal.actions import utils
from telemetry.internal.browser import browser_info as browser_info_module
from telemetry.testing import tab_test_case
@@ -12,18 +16,18 @@ class RepeatableScrollActionTest(tab_test_case.TabTestCase):
def setUp(self):
tab_test_case.TabTestCase.setUp(self)
self.Navigate('blank.html')
+ utils.InjectJavaScript(self._tab, 'gesture_common.js')
- # Make page bigger than window so it's scrollable.
- self._tab.ExecuteJavaScript('document.body.style.height = '
- ' (3 * window.innerHeight + 1) + "px";')
+ # Make page taller than window so it's scrollable.
+ self._tab.ExecuteJavaScript('document.body.style.height ='
+ '(3 * __GestureCommon_GetWindowHeight() + 1) + "px";')
self.assertEquals(
- self._tab.EvaluateJavaScript('document.documentElement.scrollTop '
- '|| document.body.scrollTop'), 0)
+ self._tab.EvaluateJavaScript('document.scrollingElement.scrollTop'), 0)
self._browser_info = browser_info_module.BrowserInfo(self._tab.browser)
- self._window_height = int(
- self._tab.EvaluateJavaScript('window.innerHeight'))
+ self._window_height = int(self._tab.EvaluateJavaScript(
+ '__GestureCommon_GetWindowHeight()'))
def testRepeatableScrollActionNoRepeats(self):
if not self._browser_info.HasRepeatableSynthesizeScrollGesture():
@@ -37,7 +41,7 @@ class RepeatableScrollActionTest(tab_test_case.TabTestCase):
i.RunAction(self._tab)
scroll_position = self._tab.EvaluateJavaScript(
- '(document.documentElement.scrollTop || document.body.scrollTop)')
+ '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,
@@ -57,8 +61,33 @@ class RepeatableScrollActionTest(tab_test_case.TabTestCase):
i.RunAction(self._tab)
scroll_position = self._tab.EvaluateJavaScript(
- '(document.documentElement.scrollTop || document.body.scrollTop)')
+ '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))
+
+ # Regression test for crbug.com/627166
+ # TODO(ulan): enable for Android after catapult:#2475 is fixed.
+ @decorators.Disabled('all')
+ 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)
+ # If scroll coordinates are computed incorrectly Chrome will crash with
+ # [FATAL:synthetic_gesture_target_base.cc(62)] Check failed:
+ # web_touch.touches[i].state != WebTouchPoint::StatePressed ||
+ # PointIsWithinContents(web_touch.touches[i].position.x,
+ # web_touch.touches[i].position.y). Touch coordinates are not within content
+ # bounds on TouchStart.
« no previous file with comments | « telemetry/telemetry/internal/actions/repeatable_scroll.py ('k') | telemetry/telemetry/internal/actions/scroll.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698