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

Unified Diff: tools/telemetry/telemetry/page/actions/scroll_unittest.py

Issue 265933006: Fix Telemetry to calculate bounding visible rect correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 | « tools/telemetry/telemetry/page/actions/gesture_common.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/scroll_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/scroll_unittest.py b/tools/telemetry/telemetry/page/actions/scroll_unittest.py
index 98684f974a8e04264c4f361e10bc2597dd31eb2e..d4630381dc89ef1f26ea5aac832a0e3b49afdd59 100644
--- a/tools/telemetry/telemetry/page/actions/scroll_unittest.py
+++ b/tools/telemetry/telemetry/page/actions/scroll_unittest.py
@@ -80,7 +80,11 @@ class ScrollActionTest(tab_test_case.TabTestCase):
# scrollable area being more than twice as tall as the viewport) would
# result in a scroll location outside of the viewport bounds.
self._tab.ExecuteJavaScript("""document.body.style.height =
- (2 * window.innerHeight + 1) + 'px';""")
+ (3 * window.innerHeight + 1) + 'px';""")
+ self._tab.ExecuteJavaScript("""document.body.style.width =
+ (3 * window.innerWidth + 1) + 'px';""")
+ self._tab.ExecuteJavaScript(
+ "window.scrollTo(window.innerWidth, window.innerHeight);")
rect_top = int(self._tab.EvaluateJavaScript(
'__GestureCommon_GetBoundingVisibleRect(document.body).top'))
@@ -97,6 +101,10 @@ class ScrollActionTest(tab_test_case.TabTestCase):
viewport_height = int(self._tab.EvaluateJavaScript('window.innerHeight'))
viewport_width = int(self._tab.EvaluateJavaScript('window.innerWidth'))
+ self.assertTrue(rect_top >= 0,
+ msg='%s >= %s' % (rect_top, 0))
+ self.assertTrue(rect_left >= 0,
+ msg='%s >= %s' % (rect_left, 0))
self.assertTrue(rect_bottom <= viewport_height,
msg='%s + %s <= %s' % (rect_top, rect_height, viewport_height))
self.assertTrue(rect_right <= viewport_width,
« no previous file with comments | « tools/telemetry/telemetry/page/actions/gesture_common.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698