Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / touch-event-cancelable.html
blob5d972836293c65c5488ec5f450483e01f7e2a5d5
1 <script src="../../../resources/js-test.js"></script>
3 <p id="description"></p>
4 <div id="console"></div>
5 <script type="text/javascript">
6 description('Test that touch events may or may not be marked cancelable. http://crbug.com/365681');
8 var gotTouchMove = false;
9 var touchEvent;
11 document.addEventListener('touchmove', function(event) {
12 shouldBeFalse('gotTouchMove');
13 gotTouchMove = true;
14 touchEvent = event;
15 shouldBeFalse('touchEvent.defaultPrevented');
16 console.log('Calling preventDefault on TouchEvent with cancelable=' + event.cancelable);
17 touchEvent.preventDefault();
18 }, false);
20 if (window.eventSender) {
21 eventSender.addTouchPoint(152, 152);
22 eventSender.touchStart();
24 eventSender.updateTouchPoint(0, 155, 155);
25 eventSender.setTouchCancelable(true);
26 debug('Sending cancelable touchmove');
27 eventSender.touchMove();
28 shouldBeTrue('gotTouchMove');
29 shouldBeTrue('touchEvent.cancelable');
30 shouldBeTrue('touchEvent.defaultPrevented');
31 gotTouchMove = false;
33 debug('');
34 debug('Sending uncancelable touchmove');
35 eventSender.setTouchCancelable(false);
36 eventSender.updateTouchPoint(0, 160, 160);
37 eventSender.touchMove();
38 shouldBeTrue('gotTouchMove');
39 shouldBeFalse('touchEvent.cancelable');
40 shouldBeFalse('touchEvent.defaultPrevented');
41 } else {
42 debug('This test requires --run-layout-test.');
45 </script>