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

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: Add test 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..31dc4f1072e9d412eff36aa05dd06dc066f1fbb8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/synthetic-events/tap-on-scaled-screen.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
bokan 2016/08/24 15:56:57 please use <!DOCTYPE html>
lanwei 2016/08/25 02:28:56 Done.
+<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);
bokan 2016/08/24 15:56:57 This will only work if the window is at the top le
lanwei 2016/08/25 02:28:56 Acknowledged.
+ assert_equals(event.screenY, y);
+}
+
+//function tap() {
tdresser 2016/08/24 12:27:49 Remove commented out line (and below).
lanwei 2016/08/25 02:28:56 Done.
+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();});
tdresser 2016/08/24 12:27:49 I think we'd normally put }); on the line below.
lanwei 2016/08/25 02:28:56 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