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

Side by Side Diff: LayoutTests/fast/events/uievent-with-inputdevice.html

Issue 1174683004: Populates sourceDevice attribute into MouseEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Create a new init function Created 5 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
OLDNEW
1 <script src="../../resources/js-test.js"></script> 1 <script src="../../resources/js-test.js"></script>
2 <script> 2 <script>
3 description("This tests that UIEvent and its subclass will have sourceDevice set to be null by default, and it can also be passed when initialization.") 3 description("This tests that UIEvent and its subclass will have sourceDevice set to be null by default, and it can also be passed when initialization.")
4 4
5 // Creating UIEvent.
5 var uievent = document.createEvent('UIEvent'); 6 var uievent = document.createEvent('UIEvent');
6 shouldBeNonNull("uievent"); 7 shouldBeNonNull("uievent");
7 shouldBeNull("uievent.sourceDevice"); 8 shouldBeNull("uievent.sourceDevice");
8 9
9 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo uchEvents: false }) }); 10 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo uchEvents: false }) });
10 shouldBeNonNull("uievent.sourceDevice"); 11 shouldBeNonNull("uievent.sourceDevice");
11 shouldBeFalse("uievent.sourceDevice.firesTouchEvents"); 12 shouldBeFalse("uievent.sourceDevice.firesTouchEvents");
12 13
13 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo uchEvents: true }) }); 14 uievent = new UIEvent('eventType', { sourceDevice: new InputDevice({ firesTo uchEvents: true }) });
14 shouldBeNonNull("uievent.sourceDevice"); 15 shouldBeNonNull("uievent.sourceDevice");
15 shouldBeTrue("uievent.sourceDevice.firesTouchEvents"); 16 shouldBeTrue("uievent.sourceDevice.firesTouchEvents");
16 17
18 // Creating TouchEvent.
17 var touchevent = document.createEvent("TouchEvent"); 19 var touchevent = document.createEvent("TouchEvent");
18 shouldBeNonNull("touchevent"); 20 shouldBeNonNull("touchevent");
19 shouldBeNull("touchevent.sourceDevice"); 21 shouldBeNull("touchevent.sourceDevice");
22
23 // Creating MouseEvent.
24 document.addEventListener("mousedown", function(event) {
25 shouldBeNonNull("event");
26 shouldBeNull("event.sourceDevice");
27 });
20 28
21 </script> 29 var e = new MouseEvent('mousedown');
30 document.dispatchEvent(e);
31
32 var sourceDevice = new InputDevice({ firesTouchEvents: false });
33 shouldBeFalse("sourceDevice.firesTouchEvents");
34
35 var mouseevent = document.createEvent("MouseEvents");
36 mouseevent.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, fa lse, false, false, false, 0, null, sourceDevice);
Rick Byers 2015/06/23 00:55:57 nit: please use the 'new MouseEvent' style instead
lanwei 2015/06/23 22:19:20 Done.
37 shouldBeNonNull("mouseevent.sourceDevice");
38 shouldBeFalse("mouseevent.sourceDevice.firesTouchEvents");
39
40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698