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;
11 document
.addEventListener('touchmove', function(event
) {
12 shouldBeFalse('gotTouchMove');
15 shouldBeFalse('touchEvent.defaultPrevented');
16 console
.log('Calling preventDefault on TouchEvent with cancelable=' + event
.cancelable
);
17 touchEvent
.preventDefault();
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');
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');
42 debug('This test requires --run-layout-test.');