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> |