Chromium Code Reviews| 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: 600px; | |
| 7 height: 600px; | |
| 8 touch-action: none; | |
| 9 } | |
| 10 </style> | |
| 11 <div id="box" ></div> | |
| 12 | |
| 13 <script type="text/javascript"> | |
| 14 | |
| 15 var touchMoveCount = 0; | |
| 16 var pointerMoveCount = 0; | |
| 17 var box = document.getElementById('box'); | |
| 18 var targetRect = box.getBoundingClientRect(); | |
| 19 var offset = 50; | |
| 20 var x = targetRect.left + offset; | |
| 21 var y = targetRect.top + offset; | |
| 22 | |
| 23 function validTouchMoveResult(event) { | |
| 24 touchMoveCount++; | |
| 25 testTouchMove.step(function () { | |
| 26 assert_equals(event.target.id, "box"); | |
| 27 }); | |
| 28 } | |
| 29 | |
| 30 function validPointerMoveResult(event) { | |
| 31 pointerMoveCount++; | |
| 32 testTouchMove.step(function () { | |
| 33 assert_equals(event.target.id, "box"); | |
| 34 assert_equals(event.pointerType, "touch"); | |
| 35 }); | |
| 36 } | |
| 37 | |
| 38 var testTouchMove = async_test('Move in the slop region.'); | |
| 39 box.addEventListener('touchmove', validTouchMoveResult); | |
| 40 box.addEventListener('pointermove', validPointerMoveResult); | |
| 41 if (window.chrome && chrome.gpuBenchmarking) { | |
|
tdresser
2017/02/02 21:30:54
Aren't we trying to use the JS wrapper of this mos
lanwei
2017/02/03 21:39:33
Done.
| |
| 42 chrome.gpuBenchmarking.pointerActionSequence( | |
| 43 [{"source": "touch", | |
| 44 "actions": [ | |
| 45 { "name": "pointerDown", "x": x, "y": y }, | |
| 46 { "name": "pointerMove", "x": x, "y": y + 10 }, | |
| 47 { "name": "pause" }, | |
| 48 { "name": "pause" }, | |
| 49 { "name": "pause" }, | |
| 50 { "name": "pointerMove", "x": x, "y": y + 6 }, | |
| 51 { "name": "pointerUp" }]}, | |
| 52 {"source": "touch", | |
| 53 "actions": [ | |
| 54 { "name": "pause" }, | |
| 55 { "name": "pause" }, | |
| 56 { "name": "pointerDown", "x": x, "y": y }, | |
| 57 { "name": "pointerMove", "x": x, "y": y + 10 }, | |
| 58 { "name": "pointerUp"}]}], function() { | |
| 59 testTouchMove.step(function () { | |
| 60 assert_equals(touchMoveCount, 2); | |
| 61 assert_equals(pointerMoveCount, 3); | |
| 62 }); | |
| 63 testTouchMove.done(); | |
| 64 }); | |
| 65 } | |
| 66 | |
| 67 </script> | |
| OLD | NEW |