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

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

Issue 346923003: Add ActionRunner wrapper for the remaining less used actions (try 2): (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unit test to skip test if touch is not supported. Created 6 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
« no previous file with comments | « tools/telemetry/telemetry/page/actions/pinch.py ('k') | tools/telemetry/telemetry/page/actions/play.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/pinch_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/pinch_unittest.py b/tools/telemetry/telemetry/page/actions/pinch_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..c510082506089ced33a8edd44a986fd39dea2a1e
--- /dev/null
+++ b/tools/telemetry/telemetry/page/actions/pinch_unittest.py
@@ -0,0 +1,40 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from telemetry.page.actions import action_runner as action_runner_module
+from telemetry.page.actions.gesture_action import GestureAction
+from telemetry.unittest import tab_test_case
+
+
+class PinchActionTest(tab_test_case.TabTestCase):
+ def setUp(self):
+ super(PinchActionTest, self).setUp()
+
+ def testPinchByApiCalledWithCorrectArguments(self):
+ self.Navigate('blank.html')
+ if not GestureAction.IsGestureSourceTypeSupported(self._tab, 'touch'):
+ return
+
+ action_runner = action_runner_module.ActionRunner(self._tab)
+ action_runner.ExecuteJavaScript('''
+ chrome.gpuBenchmarking.pinchBy = function(
+ scaleFactor, anchorLeft, anchorTop, callback, speed) {
+ window.__test_scaleFactor = scaleFactor;
+ window.__test_anchorLeft = anchorLeft;
+ window.__test_anchorTop = anchorTop;
+ window.__test_callback = callback;
+ window.__test_speed = speed;
+ window.__pinchActionDone = true;
+ };''')
+ action_runner.PinchPage(scale_factor=2)
+ self.assertEqual(
+ 2, action_runner.EvaluateJavaScript('window.__test_scaleFactor'))
+ self.assertTrue(
+ action_runner.EvaluateJavaScript('!isNaN(window.__test_anchorLeft)'))
+ self.assertTrue(
+ action_runner.EvaluateJavaScript('!isNaN(window.__test_anchorTop)'))
+ self.assertTrue(
+ action_runner.EvaluateJavaScript('!!window.__test_callback'))
+ self.assertEqual(
+ 800, action_runner.EvaluateJavaScript('window.__test_speed'))
« no previous file with comments | « tools/telemetry/telemetry/page/actions/pinch.py ('k') | tools/telemetry/telemetry/page/actions/play.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698