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

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

Issue 945393002: Adding support for diagonal scrolling to telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Accidentally had two definitions of the same function. Created 5 years, 10 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/scroll.py ('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 23dd12083721bf54b55158a521e3e0ec162674d6..e9913aeee730acfd802b2ca429b486000806960f 100644
--- a/tools/telemetry/telemetry/page/actions/scroll_unittest.py
+++ b/tools/telemetry/telemetry/page/actions/scroll_unittest.py
@@ -41,6 +41,45 @@ class ScrollActionTest(tab_test_case.TabTestCase):
self.assertTrue(scroll_position != 0,
msg='scroll_position=%d;' % (scroll_position))
+ def testDiagonalScrollAction(self):
+ self.Navigate('blank.html')
+
+ # Make page bigger than window so it's scrollable.
+ self._tab.ExecuteJavaScript("""document.body.style.height =
+ (2 * window.innerHeight + 1) + 'px';""")
+ self._tab.ExecuteJavaScript("""document.body.style.width =
+ (2 * window.innerWidth + 1) + 'px';""")
+
+ self.assertEquals(
+ self._tab.EvaluateJavaScript("""document.documentElement.scrollTop
+ || document.body.scrollTop"""), 0)
+ self.assertEquals(
+ self._tab.EvaluateJavaScript("""document.documentElement.scrollLeft
+ || document.body.scrollLeft"""), 0)
+
+ i = scroll.ScrollAction(direction='downright')
+ i.WillRunAction(self._tab)
+
+ self._tab.ExecuteJavaScript("""
+ window.__scrollAction.beginMeasuringHook = function() {
+ window.__didBeginMeasuring = true;
+ };
+ window.__scrollAction.endMeasuringHook = function() {
+ window.__didEndMeasuring = true;
+ };""")
+ i.RunAction(self._tab)
+
+ self.assertTrue(self._tab.EvaluateJavaScript('window.__didBeginMeasuring'))
+ self.assertTrue(self._tab.EvaluateJavaScript('window.__didEndMeasuring'))
nednguyen 2015/03/06 19:07:51 Why do we need this?
+
+ viewport_top = self._tab.EvaluateJavaScript(
+ '(document.documentElement.scrollTop || document.body.scrollTop)')
+ self.assertTrue(viewport_top != 0, msg='viewport_top=%d;' % viewport_top)
+
+ viewport_left = self._tab.EvaluateJavaScript(
+ '(document.documentElement.scrollLeft || document.body.scrollLeft)')
+ self.assertTrue(viewport_left != 0, msg='viewport_left=%d;' % viewport_left)
+
def testBoundingClientRect(self):
self.Navigate('blank.html')
« no previous file with comments | « tools/telemetry/telemetry/page/actions/scroll.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698