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

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

Issue 181483002: Telemetry: Clean up tap and click_element gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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/tap.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/tap_element.py
diff --git a/tools/telemetry/telemetry/page/actions/tap_element.py b/tools/telemetry/telemetry/page/actions/tap_element.py
deleted file mode 100644
index ff503e9d1cf902804f7ef902688e2a53fc5a16ac..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/page/actions/tap_element.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (c) 2013 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.core import exceptions
-from telemetry.page.actions import page_action
-
-class TapElementAction(page_action.PageAction):
- """Page action that dispatches a custom 'tap' event at an element.
-
- For pages that don't respond to 'click' events, this action offers
- an alternative to ClickElementAction.
-
- Configuration options:
- find_element_expression: a JavaScript expression that should yield
- the element to tap.
- wait_for_event: an event name that will be listened for on the Document.
- """
- def __init__(self, attributes=None):
- super(TapElementAction, self).__init__(attributes)
-
- def RunAction(self, page, tab, previous_action):
- def DoTap():
- assert hasattr(self, 'find_element_expression')
- event = 'new CustomEvent("tap", {bubbles: true})'
- code = '(%s).dispatchEvent(%s)' % (self.find_element_expression, event)
- try:
- tab.ExecuteJavaScript(code)
- except exceptions.EvaluateException:
- raise page_action.PageActionFailed(
- 'Cannot find element with code ' + self.find_element_javascript)
-
- if hasattr(self, 'wait_for_event'):
- code = ('document.addEventListener("%s", '
- 'function(){window.__tap_event_finished=true})')
- tab.ExecuteJavaScript(code % self.wait_for_event)
- DoTap()
- tab.WaitForJavaScriptExpression('window.__tap_event_finished', 60)
- else:
- DoTap()
« no previous file with comments | « tools/telemetry/telemetry/page/actions/tap.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698