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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html

Issue 2269483002: Set the coordinates of the synthetic touch event correctly in SyntheticGestureTargetAura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Scale the position later Created 4 years, 4 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: third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html b/third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html
new file mode 100644
index 0000000000000000000000000000000000000000..834942ac115fe8aeb72478c4c0f08c9faab690a4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src='../../../resources/testharness.js'></script>
+<script src='../../../resources/testharnessreport.js'></script>
+<style type="text/css">
+#box {
+ width: 300px;
+ height: 100px;
+}
+</style>
+<div id="box" ></div>
+
+<script type="text/javascript">
+
+test(function(t) {
+var receivedTap = false;
+var box = document.getElementById('box');
+var targetRect = box.getBoundingClientRect();
+var offset = 50;
+var x = targetRect.left + offset;
+var y = targetRect.top + offset;
+
+function validTapResult(event) {
+ receivedTap = true;
+ assert_equals(event.target.id, "box");
+ assert_equals(event.clientX, x);
+ assert_equals(event.clientY, y);
+ assert_equals(event.screenX, x+window.screenX);
+ assert_equals(event.screenY, y+window.screenY);
+}
+
+var testTap = async_test('Send a tap event.');
+testTap.step(function () {
+ box.addEventListener('click', validTapResult);
+ if (window.chrome && chrome.gpuBenchmarking) {
+ chrome.gpuBenchmarking.tap(x, y, function() {
+ assert_true(receivedTap);
+ testTap.done();
+ });
+ }
+});
+
+}, 'Test that chrome.gpuBenchmarking.tap always taps on the expected position no matter what the screen scale factor is.');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698