Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/touch/touch-user-gesture.html

Issue 1956493002: Remove user gestures on touches other than tap in cross-origin iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with trunk Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <script src="../../../resources/js-test.js"></script>
2 <div id="target">Target</div>
3 <div id="description">Test user gesture behavior during touch events.</div>
4 <div id="console"></div>
5
6 <script>
7
8 var openedPopup = undefined;
9 function handler(e) {
10 if (openedPopup !== undefined)
11 testFailed("Handler invoked multiple times");
12
13 var w = window.open("about:blank", "_blank");
14 if (w) {
15 w.close();
16 openedPopup = true;
17 } else {
18 openedPopup = false;
19 }
20 }
21
22 var target = document.getElementById('target');
23
24 function testPopupOnEventDuring(eventType, expectPopup, operation) {
25 openedPopup = undefined;
26 target.addEventListener(eventType, handler);
27
28 operation();
29
30 if (openedPopup===undefined)
31 testFailed(eventType + ' handler was not invoked');
32 else if (expectPopup)
33 shouldBeTrue("openedPopup");
34 else
35 shouldBeFalse("openedPopup");
36
37 target.removeEventListener(eventType, handler);
38 }
39
40 if (window.testRunner) {
41 testRunner.setCloseRemainingWindowsWhenComplete(true);
42 testRunner.setCanOpenWindows();
43 testRunner.setPopupBlockingEnabled(true);
44 }
45
46
47 var rect = target.getBoundingClientRect();
48 var targetX = rect.left + rect.width / 2;
49 var targetY = rect.top + rect.height / 2;
50
51 debug('touchstart should be a user gesture');
52 eventSender.addTouchPoint(targetX, targetY);
53 testPopupOnEventDuring('touchstart', true, function() { eventSender.touchStart() ; });
54
55 debug('touchend for the same gesture should not get a new gesture');
56 eventSender.releaseTouchPoint(0);
57 testPopupOnEventDuring('touchend', false, function() { eventSender.touchStart(); });
58
59 debug('touchmove should be a user gesture');
60 eventSender.addTouchPoint(targetX, targetY);
61 eventSender.touchStart();
62 eventSender.updateTouchPoint(0, targetX + 1, targetY);
63 testPopupOnEventDuring('touchmove', true, function() { eventSender.touchMove("mo vedBeyondSlopRegion"); });
64
65 debug('second touchmove for the same gesture should not get a new gesture');
66 eventSender.updateTouchPoint(0, targetX + 2, targetY);
67 testPopupOnEventDuring('touchmove', false, function() { eventSender.touchMove("m ovedBeyondSlopRegion"); });
68 eventSender.releaseTouchPoint(0);
69 eventSender.touchEnd();
70
71 debug('touchend should be a user gesture');
72 eventSender.addTouchPoint(targetX, targetY);
73 eventSender.touchStart();
74 eventSender.releaseTouchPoint(0);
75 testPopupOnEventDuring('touchend', true, function() { eventSender.touchEnd(); }) ;
76
77 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698