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

Unified Diff: tools/telemetry/telemetry/page/actions/tap.js

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
Index: tools/telemetry/telemetry/page/actions/tap.js
diff --git a/tools/telemetry/telemetry/page/actions/tap.js b/tools/telemetry/telemetry/page/actions/tap.js
index 83d3493311bb9c6f2e4e97bfed13891b44f981b5..8a1c7315913bad2adc9128d7465e4879a81edbe8 100644
--- a/tools/telemetry/telemetry/page/actions/tap.js
+++ b/tools/telemetry/telemetry/page/actions/tap.js
@@ -31,8 +31,8 @@
function TapAction(opt_callback) {
var self = this;
- this.beginMeasuringHook = function() {}
- this.endMeasuringHook = function() {}
+ this.beginMeasuringHook = function() {};
+ this.endMeasuringHook = function() {};
this.callback_ = opt_callback;
}
@@ -43,10 +43,6 @@
// ensures this method will be called after the document is loaded.
this.element_ = this.options_.element_;
- requestAnimationFrame(this.startPass_.bind(this));
- };
-
- TapAction.prototype.startPass_ = function() {
this.beginMeasuringHook();
var rect = __GestureCommon_GetBoundingVisibleRect(this.options_.element_);
@@ -54,6 +50,10 @@
rect.left + rect.width * this.options_.left_position_percentage_;
var position_top =
rect.top + rect.height * this.options_.top_position_percentage_;
+ if (position_left < 0 || position_left >= window.innerWidth ||
+ position_top < 0 || position_top >= window.innerHeight) {
+ throw new Error('Tap position is off-screen');
+ }
chrome.gpuBenchmarking.tap(position_left, position_top,
this.onGestureComplete_.bind(this),
this.options_.duration_ms_,
« no previous file with comments | « tools/telemetry/telemetry/page/actions/javascript_click_unittest.py ('k') | tools/telemetry/telemetry/page/actions/tap.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698