OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src='../../../resources/testharness.js'></script> |
| 3 <script src='../../../resources/testharnessreport.js'></script> |
| 4 <style type="text/css"> |
| 5 #box { |
| 6 width: 300px; |
| 7 height: 100px; |
| 8 } |
| 9 </style> |
| 10 <div id="box" ></div> |
| 11 |
| 12 <script type="text/javascript"> |
| 13 |
| 14 test(function(t) { |
| 15 var receivedTap = false; |
| 16 var box = document.getElementById('box'); |
| 17 var targetRect = box.getBoundingClientRect(); |
| 18 var offset = 50; |
| 19 var x = targetRect.left + offset; |
| 20 var y = targetRect.top + offset; |
| 21 |
| 22 function validTapResult(event) { |
| 23 receivedTap = true; |
| 24 assert_equals(event.target.id, "box"); |
| 25 assert_equals(event.clientX, x); |
| 26 assert_equals(event.clientY, y); |
| 27 assert_equals(event.screenX, x+window.screenX); |
| 28 assert_equals(event.screenY, y+window.screenY); |
| 29 } |
| 30 |
| 31 var testTap = async_test('Send a tap event.'); |
| 32 testTap.step(function () { |
| 33 box.addEventListener('click', validTapResult); |
| 34 if (window.chrome && chrome.gpuBenchmarking) { |
| 35 chrome.gpuBenchmarking.tap(x, y, function() { |
| 36 assert_true(receivedTap); |
| 37 testTap.done(); |
| 38 }); |
| 39 } |
| 40 }); |
| 41 |
| 42 }, 'Test that chrome.gpuBenchmarking.tap always taps on the expected position no
matter what the screen scale factor is.'); |
| 43 |
| 44 </script> |
OLD | NEW |