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

Side by Side Diff: LayoutTests/fast/events/event-trusted.html

Issue 1285793004: isTrusted is incorrect for events generated by Element.click() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change bool on SimulatedMouseEvent to the enum class introduced everywhere else Created 5 years, 4 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/event-trusted-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
1 <input id="clitty-click" type="checkbox"/> 1 <input id="clitty-click" type="checkbox"/>
2 <div id="console"/> 2 <div id="console"/>
3 <script src="../../resources/js-test.js"></script> 3 <script src="../../resources/js-test.js"></script>
4 <script> 4 <script>
5 description("This tests that isTrusted returns the correct value under certain s ituations.") 5 description("This tests that isTrusted returns the correct value under certain s ituations.")
6 6
7 var redispatched = false; 7 var redispatched = false;
8 8
9 function createAndInitEvent() { 9 function createAndInitEvent() {
10 var e = document.createEvent('Event'); 10 var e = document.createEvent('Event');
11 e.initEvent(false, false, false); 11 e.initEvent(false, false, false);
12 return e; 12 return e;
13 } 13 }
14 14
15 shouldBeFalse("document.createEvent('Event').isTrusted"); 15 shouldBeFalse("document.createEvent('Event').isTrusted");
16 shouldBeFalse("createAndInitEvent().isTrusted"); 16 shouldBeFalse("createAndInitEvent().isTrusted");
17 17
18 function originalDispatch(e) { 18 function originalDispatch(e) {
19 originalEvent = e; 19 originalEvent = e;
20 } 20 }
21 21
22 function redispatch(e) { 22 function redispatch(e) {
23 redispatched = true; 23 redispatched = true;
24 } 24 }
25 25
26 var element = document.getElementById("clitty-click"); 26 var element = document.getElementById("clitty-click");
27 if (window.eventSender) { 27 if (window.eventSender) {
28 element.addEventListener('click', originalDispatch); 28 element.addEventListener('click', originalDispatch);
29 element.addEventListener('focus', function (e) { 29 element.addEventListener('focus', function (e) {
30 event = e; 30 event = e;
31 shouldBeTrue("event.isTrusted"); 31 shouldBeTrue("event.isTrusted");
32 }); 32 });
33 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop); 33 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
34 eventSender.mouseDown(); 34 eventSender.mouseDown();
35 eventSender.mouseUp(); 35 eventSender.mouseUp();
36 36
37 shouldBeTrue("originalEvent.isTrusted"); 37 shouldBeTrue("originalEvent.isTrusted");
38 element.removeEventListener('click', originalDispatch); 38 element.removeEventListener('click', originalDispatch);
39 element.addEventListener('click', redispatch); 39 element.addEventListener('click', redispatch);
40 40
41 element.dispatchEvent(originalEvent); 41 element.dispatchEvent(originalEvent);
42 shouldBeTrue("redispatched"); 42 shouldBeTrue("redispatched");
43 shouldBeFalse("originalEvent.isTrusted"); 43 shouldBeFalse("originalEvent.isTrusted");
44
45 originalEvent = null;
46 element.removeEventListener('click', redispatch);
47 element.addEventListener('click', originalDispatch);
48 element.click();
49 shouldBeFalse("originalEvent.isTrusted");
44 } 50 }
45 51
46 </script> 52 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/event-trusted-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698