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

Side by Side Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-result.html

Issue 267313008: First-cut at fixing unhandled Tap event returns in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add Layout tests, and remove unit tests. Cleanup EventHandler. Created 6 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/touch/gesture/gesture-tap-result-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 </head>
6 <body onload="runTest();">
7
8 <input id="input" type="text" value="editable text">
9 <span id="plain">This is plain text with no handler</span>
10 <span id="consumes">This text consumes events using preventDefault()</span>
11
12 <p id="description"></p>
13 <div id="console"></div>
14
15 <script>
16 var mouseEventsReceived = 0;
17 var plainResult = null;
18 var consumesResult = null;
19
20 function plainCallback() {
21 mouseEventsReceived++;
22 }
23
24 function consumeCallback(event) {
25 mouseEventsReceived++;
26 event.preventDefault();
27 }
28
29 // Because we may not have a gesture recognizer, we send a key press
30 // event to end the test without temporal flakiness.
Rick Byers 2014/06/03 14:41:54 Chrome now always has a "gesture recognizer" (the
donnd 2014/06/03 20:24:57 Sorry about not removing this earlier. I copied s
31 function quitKeyToEndTest(event) {
32 endTest();
33 }
34
35 function endTest() {
36 if (mouseEventsReceived == 0) {
Rick Byers 2014/06/03 14:41:54 No reason to make this it's own function - just ke
donnd 2014/06/03 20:24:57 It looks like this isn't needed either. Also, tha
37 debug('Gesture manager not implemented on this platform.');
38 }
39 // Bail.
40 isSuccessfullyParsed();
41 testRunner.notifyDone();
42 }
43
44 function runTest() {
45 document.getElementById('input').select();
46 var consumes = document.getElementById('consumes');
47 consumes.addEventListener("mousedown", consumeCallback, false);
48 consumes.addEventListener("click", consumeCallback, false);
49 consumes.addEventListener("dblclick", consumeCallback, false);
50 consumes.addEventListener("mouseup", consumeCallback, false);
51 consumes.addEventListener("mousemove", consumeCallback, false);
52 var plain = document.getElementById('plain');
53 plain.addEventListener("mousedown", plainCallback, false);
54 plain.addEventListener("click", plainCallback, false);
55 plain.addEventListener("dblclick", plainCallback, false);
56 plain.addEventListener("mouseup", plainCallback, false);
57 plain.addEventListener("mousemove", plainCallback, false);
58 document.addEventListener("keydown", quitKeyToEndTest, false);
59
60 if (window.testRunner) {
61 testRunner.dumpAsText();
62 testRunner.waitUntilDone();
63 }
64
65 if (window.eventSender) {
66 description("This tests Tap events being consumed by a handler.");
67
68 // A 'tap' gesture event should generate a sequence of mouse events,
69 // which do not affect the selection when consumed.
70 var consumesRect = document.getElementById('consumes').getBoundingClient Rect();
71 consumesResult = eventSender.gestureTap(consumesRect.left, consumesRect. top);
72 shouldBe('consumesResult', 'true');
73 shouldNotBe('window.getSelection().toString()', '');
74
75 // Tapping on plain text does not consume the event, and clears the sele ction.
76 var plainRect = document.getElementById('plain').getBoundingClientRect() ;
77 plainResult = eventSender.gestureTap(plainRect.left, plainRect.top);
78 shouldBe('plainResult', 'false');
79 shouldBeEmptyString('window.getSelection().toString()');
80
81 eventSender.leapForward(10);
Rick Byers 2014/06/03 14:41:54 Is this necessary? I thought the saved events / l
donnd 2014/06/03 20:24:57 Done.
82 eventSender.keyDown(' ');
83 } else {
84 debug("This test requires DumpRenderTree. Tap on the text to log.")
85 }
86 }
87 </script>
88 </body>
89 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/touch/gesture/gesture-tap-result-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698