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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/Document-createEvent.html

Issue 1899623002: Import latest web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle new failures Created 4 years, 8 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset=utf-8> 2 <meta charset=utf-8>
3 <title>Document.createEvent</title> 3 <title>Document.createEvent</title>
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createevent"> 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createevent">
5 <script src="../../../../resources/testharness.js"></script> 5 <script src="../../../../resources/testharness.js"></script>
6 <script src="../../../../resources/testharnessreport.js"></script> 6 <script src="../../../../resources/testharnessreport.js"></script>
7 <script src="Document-createEvent.js"></script> 7 <script src="Document-createEvent.js"></script>
8 <div id="log"></div> 8 <div id="log"></div>
9 <script> 9 <script>
10 function testAlias(arg, iface) { 10 function testAlias(arg, iface) {
(...skipping 21 matching lines...) Expand all
32 assert_equals(ev.isTrusted, false, 32 assert_equals(ev.isTrusted, false,
33 "isTrusted should be initialized to false"); 33 "isTrusted should be initialized to false");
34 }, "createEvent('" + arg + "') should be initialized correctly."); 34 }, "createEvent('" + arg + "') should be initialized correctly.");
35 } 35 }
36 for (var alias in aliases) { 36 for (var alias in aliases) {
37 var iface = aliases[alias]; 37 var iface = aliases[alias];
38 testAlias(alias, iface); 38 testAlias(alias, iface);
39 testAlias(alias.toLowerCase(), iface); 39 testAlias(alias.toLowerCase(), iface);
40 testAlias(alias.toUpperCase(), iface); 40 testAlias(alias.toUpperCase(), iface);
41 41
42 if (!alias.endsWith("s")) { 42 if (alias[alias.length - 1] != "s") {
43 var plural = alias + "s"; 43 var plural = alias + "s";
44 if (!(plural in aliases)) { 44 if (!(plural in aliases)) {
45 test(function () { 45 test(function () {
46 assert_throws("NOT_SUPPORTED_ERR", function () { 46 assert_throws("NOT_SUPPORTED_ERR", function () {
47 var evt = document.createEvent(plural); 47 var evt = document.createEvent(plural);
48 }); 48 });
49 }, 'Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface " ' + plural + '"'); 49 }, 'Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface " ' + plural + '"');
50 } 50 }
51 } 51 }
52 } 52 }
53 53
54 test(function() { 54 test(function() {
55 assert_throws("NOT_SUPPORTED_ERR", function() { 55 assert_throws("NOT_SUPPORTED_ERR", function() {
56 var evt = document.createEvent("foo"); 56 var evt = document.createEvent("foo");
57 }); 57 });
58 assert_throws("NOT_SUPPORTED_ERR", function() { 58 assert_throws("NOT_SUPPORTED_ERR", function() {
59 // 'LATIN CAPITAL LETTER I WITH DOT ABOVE' (U+0130) 59 // 'LATIN CAPITAL LETTER I WITH DOT ABOVE' (U+0130)
60 var evt = document.createEvent("U\u0130Event"); 60 var evt = document.createEvent("U\u0130Event");
61 }); 61 });
62 assert_throws("NOT_SUPPORTED_ERR", function() { 62 assert_throws("NOT_SUPPORTED_ERR", function() {
63 // 'LATIN SMALL LETTER DOTLESS I' (U+0131) 63 // 'LATIN SMALL LETTER DOTLESS I' (U+0131)
64 var evt = document.createEvent("U\u0131Event"); 64 var evt = document.createEvent("U\u0131Event");
65 }); 65 });
66 }, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments"); 66 }, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments");
67 67
68 /* 68 /*
69 The following are event interfaces which do actually exist, but must still 69 * The following are event interfaces which do actually exist, but must still
70 throw since they're absent from the table in the spec 70 * throw since they're absent from the table in the spec for
71 for document.createEvent(). 71 * document.createEvent(). This list is not exhaustive, but includes all
72 This list is not exhaustive. 72 * interfaces that it is known some UA does or did not throw for.
73 */ 73 */
74 var someNonCreateableEvents = [ 74 var someNonCreateableEvents = [
75 "AnimationEvent", 75 "AnimationEvent",
76 "AnimationPlayerEvent", 76 "AnimationPlayerEvent",
77 "ApplicationCacheErrorEvent", 77 "ApplicationCacheErrorEvent",
78 "AudioProcessingEvent", 78 "AudioProcessingEvent",
79 "AutocompleteErrorEvent", 79 "AutocompleteErrorEvent",
80 "BeforeInstallPromptEvent", 80 "BeforeInstallPromptEvent",
81 "BeforeUnloadEvent", 81 "BeforeUnloadEvent",
82 "BlobEvent", 82 "BlobEvent",
83 "ClipboardEvent", 83 "ClipboardEvent",
84 "CloseEvent", 84 "CloseEvent",
85 "CommandEvent",
85 "CompositionEvent", 86 "CompositionEvent",
87 "DataContainerEvent",
86 "DeviceLightEvent", 88 "DeviceLightEvent",
87 "DeviceMotionEvent", 89 "DeviceMotionEvent",
88 "DeviceOrientationEvent", 90 "DeviceOrientationEvent",
89 "DragEvent", 91 "DragEvent",
90 "ErrorEvent", 92 "ErrorEvent",
91 "ExtendableEvent", 93 "ExtendableEvent",
92 "ExtendableMessageEvent", 94 "ExtendableMessageEvent",
93 "FetchEvent", 95 "FetchEvent",
94 "FocusEvent", 96 "FocusEvent",
95 "FontFaceSetLoadEvent", 97 "FontFaceSetLoadEvent",
96 "GamepadEvent", 98 "GamepadEvent",
97 "GeofencingEvent", 99 "GeofencingEvent",
98 "HashChangeEvent", 100 "HashChangeEvent",
99 "IDBVersionChangeEvent", 101 "IDBVersionChangeEvent",
100 "InstallEvent", 102 "InstallEvent",
101 "KeyEvent", 103 "KeyEvent",
102 "MIDIConnectionEvent", 104 "MIDIConnectionEvent",
103 "MIDIMessageEvent", 105 "MIDIMessageEvent",
104 "MediaEncryptedEvent", 106 "MediaEncryptedEvent",
105 "MediaKeyEvent", 107 "MediaKeyEvent",
106 "MediaKeyMessageEvent", 108 "MediaKeyMessageEvent",
107 "MediaQueryListEvent", 109 "MediaQueryListEvent",
108 "MediaStreamEvent", 110 "MediaStreamEvent",
109 "MediaStreamTrackEvent", 111 "MediaStreamTrackEvent",
112 "MouseScrollEvent",
110 "MutationEvent", 113 "MutationEvent",
111 "NotificationEvent", 114 "NotificationEvent",
115 "NotifyPaintEvent",
112 "OfflineAudioCompletionEvent", 116 "OfflineAudioCompletionEvent",
113 "OrientationEvent", 117 "OrientationEvent",
118 "PageTransition", // Yes, with no "Event"
114 "PageTransitionEvent", 119 "PageTransitionEvent",
115 "PointerEvent", 120 "PointerEvent",
116 "PopStateEvent", 121 "PopStateEvent",
122 "PopUpEvent",
117 "PresentationConnectionAvailableEvent", 123 "PresentationConnectionAvailableEvent",
118 "PresentationConnectionCloseEvent", 124 "PresentationConnectionCloseEvent",
119 "ProgressEvent", 125 "ProgressEvent",
120 "PromiseRejectionEvent", 126 "PromiseRejectionEvent",
121 "PushEvent", 127 "PushEvent",
122 "RTCDTMFToneChangeEvent", 128 "RTCDTMFToneChangeEvent",
123 "RTCDataChannelEvent", 129 "RTCDataChannelEvent",
124 "RTCIceCandidateEvent", 130 "RTCIceCandidateEvent",
125 "RelatedEvent", 131 "RelatedEvent",
126 "ResourceProgressEvent", 132 "ResourceProgressEvent",
127 "SVGEvent", 133 "SVGEvent",
128 "SVGZoomEvent", 134 "SVGZoomEvent",
135 "ScrollAreaEvent",
129 "SecurityPolicyViolationEvent", 136 "SecurityPolicyViolationEvent",
130 "ServicePortConnectEvent", 137 "ServicePortConnectEvent",
131 "ServiceWorkerMessageEvent", 138 "ServiceWorkerMessageEvent",
139 "SimpleGestureEvent",
132 "SpeechRecognitionError", 140 "SpeechRecognitionError",
133 "SpeechRecognitionEvent", 141 "SpeechRecognitionEvent",
134 "SpeechSynthesisEvent", 142 "SpeechSynthesisEvent",
135 "StorageEvent", 143 "StorageEvent",
136 "SyncEvent", 144 "SyncEvent",
137 "TextEvent", 145 "TextEvent",
146 "TimeEvent",
138 "TrackEvent", 147 "TrackEvent",
139 "TransitionEvent", 148 "TransitionEvent",
140 "WebGLContextEvent", 149 "WebGLContextEvent",
141 "WebKitAnimationEvent", 150 "WebKitAnimationEvent",
142 "WebKitTransitionEvent", 151 "WebKitTransitionEvent",
143 "WheelEvent" 152 "WheelEvent",
153 "XULCommandEvent",
144 ]; 154 ];
145 someNonCreateableEvents.forEach(function (eventInterface) { 155 someNonCreateableEvents.forEach(function (eventInterface) {
146 test(function () { 156 test(function () {
147 assert_throws("NOT_SUPPORTED_ERR", function () { 157 assert_throws("NOT_SUPPORTED_ERR", function () {
148 var evt = document.createEvent(eventInterface); 158 var evt = document.createEvent(eventInterface);
149 }); 159 });
150 }, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + eventIn terface + '"'); 160 }, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + eventIn terface + '"');
151 161
152 test(function () { 162 test(function () {
153 assert_throws("NOT_SUPPORTED_ERR", function () { 163 assert_throws("NOT_SUPPORTED_ERR", function () {
154 var evt = document.createEvent(eventInterface + "s"); 164 var evt = document.createEvent(eventInterface + "s");
155 }); 165 });
156 }, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface " ' + eventInterface + '"'); 166 }, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface " ' + eventInterface + 's"');
157 }); 167 });
158 </script> 168 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698