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

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

Issue 117283004: Telemetry: Add 'wait_after' parameter to gesture actions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove "(c)" in copyright statement. Created 6 years, 11 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_action.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/gesture_action_unittest.py
diff --git a/tools/telemetry/telemetry/page/actions/gesture_action_unittest.py b/tools/telemetry/telemetry/page/actions/gesture_action_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..011111f091a309e617cf2d9389ca9cd0a8b0d96f
--- /dev/null
+++ b/tools/telemetry/telemetry/page/actions/gesture_action_unittest.py
@@ -0,0 +1,37 @@
+# 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.
+
+import time
+
+from telemetry.page.actions import gesture_action
+from telemetry.unittest import tab_test_case
+
+class MockGestureAction(gesture_action.GestureAction):
+ """Mock gesture action that simply sleeps for a specified amount of time."""
+ def __init__(self, attributes=None):
+ super(MockGestureAction, self).__init__(attributes)
+ self._SetTimelineMarkerBaseName('MockGestureAction::RunAction')
+
+ def RunGesture(self, page, tab, previous_action):
+ duration = getattr(self, 'duration', 2)
+
+ time.sleep(duration)
+
+
+class GestureActionTest(tab_test_case.TabTestCase):
+ def testGestureAction(self):
+ """Test that GestureAction.RunAction() calls RunGesture()."""
+ action = MockGestureAction({ 'duration': 1 })
+
+ start_time = time.time()
+ action.RunAction(None, self._tab, None)
+ self.assertGreaterEqual(time.time() - start_time, 1.0)
+
+ def testWaitAfter(self):
+ action = MockGestureAction({ 'duration': 1,
+ 'wait_after': { 'seconds': 1 } })
+
+ start_time = time.time()
+ action.RunAction(None, self._tab, None)
+ self.assertGreaterEqual(time.time() - start_time, 2.0)
« no previous file with comments | « tools/telemetry/telemetry/page/actions/gesture_action.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698