Chromium Code Reviews| 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> |