Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!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.
| |
| 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); | |
|
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.
| |
| 28 assert_equals(event.screenY, y); | |
| 29 } | |
| 30 | |
| 31 //function tap() { | |
|
tdresser
2016/08/24 12:27:49
Remove commented out line (and below).
lanwei
2016/08/25 02:28:56
Done.
| |
| 32 var testTap = async_test('Send a tap event.'); | |
| 33 testTap.step(function () { | |
| 34 box.addEventListener('click', validTapResult); | |
| 35 if (window.chrome && chrome.gpuBenchmarking) { | |
| 36 chrome.gpuBenchmarking.tap(x, y, function() { | |
| 37 assert_true(receivedTap); | |
| 38 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.
| |
| 39 } | |
| 40 }); | |
| 41 //} | |
| 42 | |
| 43 }, 'Test that chrome.gpuBenchmarking.tap always taps on the expected position no matter what the screen scale factor is.'); | |
| 44 | |
| 45 </script> | |
| OLD | NEW |