Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-creation.html
blob4a8c377f30f8961c92ea9eaa7dd823feca4c0c84
1 <head>
2 <script src="../../resources/js-test.js"></script>
3 </head>
4 <body>
5 <script>
6 description("This tests that document.createEvent is hooked up for all Event interfaces (and alternatives) and creates the right instance.")
8 // AnimationEvent
9 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.AnimationEvent");
10 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event");
11 shouldBeTrue("document.createEvent('AnimationEvent').constructor === window.AnimationEvent");
13 // Event
14 shouldBeTrue("document.createEvent('Event') instanceof window.Event");
15 shouldBeTrue("document.createEvent('Event').constructor === window.Event");
16 shouldBeTrue("document.createEvent('EvENt') instanceof window.Event");
17 shouldBeTrue("document.createEvent('EvENt').constructor === window.Event");
19 // Events (Event alternative)
20 shouldBeTrue("document.createEvent('Events') instanceof window.Event");
21 shouldBeTrue("document.createEvent('Events').constructor === window.Event");
22 shouldBeTrue("document.createEvent('EvENts') instanceof window.Event");
23 shouldBeTrue("document.createEvent('EvENts').constructor === window.Event");
25 // HTMLEvents (Event alternative)
26 shouldBeTrue("document.createEvent('HTMLEvents') instanceof window.Event");
27 shouldBeTrue("document.createEvent('HTMLEvents').constructor === window.Event");
28 shouldBeTrue("document.createEvent('HTMLEvENts') instanceof window.Event");
29 shouldBeTrue("document.createEvent('HTMLEvENts').constructor === window.Event");
31 // CompositionEvent
32 shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.CompositionEvent");
33 shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.Event");
34 shouldBeTrue("document.createEvent('CompositionEvent').constructor === window.CompositionEvent");
36 // CustomEvent
37 shouldBeTrue("document.createEvent('CustomEvent') instanceof window.CustomEvent");
38 shouldBeTrue("document.createEvent('CustomEvent') instanceof window.Event");
39 shouldBeTrue("document.createEvent('CustomEvent').constructor === window.CustomEvent");
40 shouldBeTrue("document.createEvent('CustomEvENt') instanceof window.CustomEvent");
41 shouldBeTrue("document.createEvent('CustomEvENt') instanceof window.Event");
42 shouldBeTrue("document.createEvent('CustomEvENt').constructor === window.CustomEvent");
44 // ErrorEvent
45 shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.ErrorEvent");
46 shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.Event");
47 shouldBeTrue("document.createEvent('ErrorEvent').constructor === window.ErrorEvent");
49 // HashChangeEvent
50 shouldBeTrue("document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent");
51 shouldBeTrue("document.createEvent('HashChangeEvent') instanceof window.Event");
52 shouldBeTrue("document.createEvent('HashChangeEvent').constructor === window.HashChangeEvent");
54 // KeyboardEvent
55 shouldBeTrue("document.createEvent('KeyboardEvent') instanceof window.KeyboardEvent");
56 shouldBeTrue("document.createEvent('KeyboardEvent') instanceof window.UIEvent");
57 shouldBeTrue("document.createEvent('KeyboardEvent') instanceof window.Event");
58 shouldBeTrue("document.createEvent('KeyboardEvent').constructor === window.KeyboardEvent");
60 // KeyboardEvents (KeyboardEvent alternative)
61 shouldBeTrue("document.createEvent('KeyboardEvents') instanceof window.KeyboardEvent");
62 shouldBeTrue("document.createEvent('KeyboardEvents') instanceof window.UIEvent");
63 shouldBeTrue("document.createEvent('KeyboardEvents') instanceof window.Event");
64 shouldBeTrue("document.createEvent('KeyboardEvents').constructor === window.KeyboardEvent");
66 // MessageEvent
67 shouldBeTrue("document.createEvent('MessageEvent') instanceof window.MessageEvent");
68 shouldBeTrue("document.createEvent('MessageEvent') instanceof window.Event");
69 shouldBeTrue("document.createEvent('MessageEvent').constructor === window.MessageEvent");
71 // MouseEvent
72 shouldBeTrue("document.createEvent('MouseEvent') instanceof window.MouseEvent");
73 shouldBeTrue("document.createEvent('MouseEvent') instanceof window.UIEvent");
74 shouldBeTrue("document.createEvent('MouseEvent') instanceof window.Event");
75 shouldBeTrue("document.createEvent('MouseEvent').constructor === window.MouseEvent");
76 shouldBeTrue("document.createEvent('MouseEvENt') instanceof window.MouseEvent");
77 shouldBeTrue("document.createEvent('MouseEvENt') instanceof window.UIEvent");
78 shouldBeTrue("document.createEvent('MouseEvENt') instanceof window.Event");
79 shouldBeTrue("document.createEvent('MouseEvENt').constructor === window.MouseEvent");
81 // MouseEvents (MouseEvent alternative)
82 shouldBeTrue("document.createEvent('MouseEvents') instanceof window.MouseEvent");
83 shouldBeTrue("document.createEvent('MouseEvents') instanceof window.UIEvent");
84 shouldBeTrue("document.createEvent('MouseEvents') instanceof window.Event");
85 shouldBeTrue("document.createEvent('MouseEvents').constructor === window.MouseEvent");
86 shouldBeTrue("document.createEvent('MouseEvENts') instanceof window.MouseEvent");
87 shouldBeTrue("document.createEvent('MouseEvENts') instanceof window.UIEvent");
88 shouldBeTrue("document.createEvent('MouseEvENts') instanceof window.Event");
89 shouldBeTrue("document.createEvent('MouseEvENts').constructor === window.MouseEvent");
91 // MutationEvent
92 shouldBeTrue("document.createEvent('MutationEvent') instanceof window.MutationEvent");
93 shouldBeTrue("document.createEvent('MutationEvent') instanceof window.Event");
94 shouldBeTrue("document.createEvent('MutationEvent').constructor === window.MutationEvent");
96 // MutationEvents (MutationEvent alternative)
97 shouldBeTrue("document.createEvent('MutationEvents') instanceof window.MutationEvent");
98 shouldBeTrue("document.createEvent('MutationEvents') instanceof window.Event");
99 shouldBeTrue("document.createEvent('MutationEvents').constructor === window.MutationEvent");
101 // PageTransitionEvent
102 shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.PageTransitionEvent");
103 shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.Event");
104 shouldBeTrue("document.createEvent('PageTransitionEvent').constructor === window.PageTransitionEvent");
106 // PopStateEvent
107 shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.PopStateEvent");
108 shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.Event");
109 shouldBeTrue("document.createEvent('PopStateEvent').constructor === window.PopStateEvent");
111 // ProgressEvent
112 shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.ProgressEvent");
113 shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.Event");
114 shouldBeTrue("document.createEvent('ProgressEvent').constructor === window.ProgressEvent");
116 // TextEvent
117 shouldBeTrue("document.createEvent('TextEvent') instanceof window.TextEvent");
118 shouldBeTrue("document.createEvent('TextEvent') instanceof window.UIEvent");
119 shouldBeTrue("document.createEvent('TextEvent') instanceof window.Event");
120 shouldBeTrue("document.createEvent('TextEvent').constructor === window.TextEvent");
122 // UIEvent
123 shouldBeTrue("document.createEvent('UIEvent') instanceof window.UIEvent");
124 shouldBeTrue("document.createEvent('UIEvent') instanceof window.Event");
125 shouldBeTrue("document.createEvent('UIEvent').constructor === window.UIEvent");
126 shouldBeTrue("document.createEvent('UIEvENt') instanceof window.UIEvent");
127 shouldBeTrue("document.createEvent('UIEvENt') instanceof window.Event");
128 shouldBeTrue("document.createEvent('UIEvENt').constructor === window.UIEvent");
130 // UIEvents (UIEvent alternative)
131 shouldBeTrue("document.createEvent('UIEvents') instanceof window.UIEvent");
132 shouldBeTrue("document.createEvent('UIEvents') instanceof window.Event");
133 shouldBeTrue("document.createEvent('UIEvents').constructor === window.UIEvent");
134 shouldBeTrue("document.createEvent('UIEvENts') instanceof window.UIEvent");
135 shouldBeTrue("document.createEvent('UIEvENts') instanceof window.Event");
136 shouldBeTrue("document.createEvent('UIEvENts').constructor === window.UIEvent");
138 // TransitionEvent
139 shouldBeTrue("document.createEvent('TransitionEvent') instanceof window.TransitionEvent");
140 shouldBeTrue("document.createEvent('TransitionEvent') instanceof window.Event");
141 shouldBeTrue("document.createEvent('TransitionEvent').constructor === window.TransitionEvent");
143 // WebKitAnimationEvent
144 shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.WebKitAnimationEvent");
145 shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.Event");
146 shouldBeTrue("document.createEvent('WebKitAnimationEvent').constructor === window.WebKitAnimationEvent");
148 // WebKitTransitionEvent
149 shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.WebKitTransitionEvent");
150 shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.Event");
151 shouldBeTrue("document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent");
153 // WheelEvent
154 shouldBeTrue("document.createEvent('WheelEvent') instanceof window.WheelEvent");
155 shouldBeTrue("document.createEvent('WheelEvent') instanceof window.MouseEvent");
156 shouldBeTrue("document.createEvent('WheelEvent') instanceof window.UIEvent");
157 shouldBeTrue("document.createEvent('WheelEvent') instanceof window.Event");
158 shouldBeTrue("document.createEvent('WheelEvent').constructor === window.WheelEvent");
160 // XMLHttpRequestProgressEvent
161 shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.XMLHttpRequestProgressEvent");
162 shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.ProgressEvent");
163 shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.Event");
164 shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent').constructor === window.XMLHttpRequestProgressEvent");
166 // StorageEvent
167 shouldBeTrue("document.createEvent('StorageEvent') instanceof window.StorageEvent");
168 shouldBeTrue("document.createEvent('StorageEvent') instanceof window.Event");
169 shouldBeTrue("document.createEvent('StorageEvent').constructor === window.StorageEvent");
171 // SVGEvents (Event alternative)
172 shouldBeTrue("document.createEvent('SVGEvents') instanceof window.Event");
173 shouldBeTrue("document.createEvent('SVGEvents').constructor === window.Event");
175 // SVGZoomEvent
176 shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.SVGZoomEvent");
177 shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.Event");
178 shouldBeTrue("document.createEvent('SVGZoomEvent').constructor === window.SVGZoomEvent");
180 // SVGZoomEvents (SVGZoomEvent alternative)
181 shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.SVGZoomEvent");
182 shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.Event");
183 shouldBeTrue("document.createEvent('SVGZoomEvents').constructor === window.SVGZoomEvent");
185 // CloseEvent
186 shouldBeTrue("document.createEvent('CloseEvent') instanceof window.CloseEvent");
187 shouldBeTrue("document.createEvent('CloseEvent') instanceof window.Event");
188 shouldBeTrue("document.createEvent('CloseEvent').constructor === window.CloseEvent");
190 // The following are here for completeness, but won't until there is more widespread support for them.
192 // #if ENABLE(WEB_AUDIO)
193 // AudioProcessingEvent
194 // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.AudioProcessingEvent");
195 // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.Event");
196 // shouldBeTrue("document.createEvent('AudioProcessingEvent').constructor === window.AudioProcessingEvent");
198 // #if ENABLE(WEB_AUDIO)
199 // OfflineAudioCompletionEvent
200 // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.OfflineAudioCompletionEvent");
201 // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.Event");
202 // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent').constructor === window.OfflineAudioCompletionEvent");
204 // MediaStreamEvent
205 // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.MediaStreamEvent");
206 // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.Event");
207 // shouldBeTrue("document.createEvent('MediaStreamEvent').constructor === window.MediaStreamEvent");
209 // #if ENABLE(WEBGL)
210 // WebGLContextEvent
211 // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.WebGLContextEvent");
212 // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.Event");
213 // shouldBeTrue("document.createEvent('WebGLContextEvent').constructor === window.WebGLContextEvent");
215 // TouchEvent
216 shouldBeTrue("document.createEvent('TouchEvent') instanceof window.TouchEvent");
217 shouldBeTrue("document.createEvent('TouchEvent') instanceof window.Event");
218 shouldBeTrue("document.createEvent('TouchEvent').constructor === window.TouchEvent");
220 // DeviceMotionEvent
221 // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window.DeviceMotionEvent");
222 // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window.Event");
223 // shouldBeTrue("document.createEvent('DeviceMotionEvent').constructor === window.DeviceMotionEvent");
225 // DeviceOrientationEvent
226 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof window.DeviceOrientationEvent");
227 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof window.Event");
228 // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor === window.DeviceOrientationEvent");
230 // OrientationEvent (Event alternative)
231 // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.Event");
232 // shouldBeTrue("document.createEvent('OrientationEvent').constructor === window.Event");
234 // AutocompleteErrorEvent
235 shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.AutocompleteErrorEvent");
236 shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.Event");
237 shouldBeTrue("document.createEvent('AutocompleteErrorEvent').constructor === window.AutocompleteErrorEvent");
239 // We test both a hard coded set and the automated set below (using enumeration) to ensure that a constructor being removed
240 // from the window is caught a regression.
242 var allEventInterfacesCreateEvents = true;
243 for (var propertyName in window) {
244 if (propertyName.match(/Event$/) && window[propertyName].toString().match(/EventConstructor\]$/)) {
245 try {
246 if (!(document.createEvent(propertyName) instanceof window.Event)) {
247 allEventInterfacesCreateEvents = false;
248 debug("'document.createEvent(propertyName) instanceof window.Event' with propertyName: " + propertyName + " should be true but isn't");
250 } catch (e) {
251 allEventInterfacesCreateEvents = false;
252 debug("'document.createEvent(propertyName) instanceof window.Event' with propertyName: " + propertyName + " threw an exception: " + e);
255 try {
256 if (!(document.createEvent(propertyName) instanceof window[propertyName])) {
257 allEventInterfacesCreateEvents = false;
258 debug("'document.createEvent(propertyName) instanceof window[propertyName]' with propertyName: " + propertyName + " should be true but isn't");
260 } catch (e) {
261 allEventInterfacesCreateEvents = false;
262 debug("'document.createEvent(propertyName) instanceof window[propertyName]' with propertyName: " + propertyName + " threw an exception: " + e);
265 try {
266 if (!(document.createEvent(propertyName).constructor === window[propertyName])) {
267 allEventInterfacesCreateEvents = false;
268 debug("'document.createEvent(propertyName).constructor === window[propertyName]' with propertyName: " + propertyName + " should be true but isn't");
270 } catch (e) {
271 allEventInterfacesCreateEvents = false;
272 debug("'document.createEvent(propertyName).constructor === window[propertyName]' with propertyName: " + propertyName + " threw an exception: " + e);
276 shouldBeTrue('allEventInterfacesCreateEvents');
277 </script>
281 </body>