Video is not started even if play button has been pressed.
[framework/web/webkit-efl.git] / LayoutTests / fast / events / event-creation.html
1 <head>
2 <script src="../js/resources/js-test-pre.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.")
7
8     // Event
9     shouldBeTrue("document.createEvent('Event') instanceof window.Event");
10     shouldBeTrue("document.createEvent('Event').constructor === window.Event");
11
12     // Events (Event alternative)
13     shouldBeTrue("document.createEvent('Events') instanceof window.Event");
14     shouldBeTrue("document.createEvent('Events').constructor === window.Event");
15
16     // HTMLEvents (Event alternative)
17     shouldBeTrue("document.createEvent('HTMLEvents') instanceof window.Event");
18     shouldBeTrue("document.createEvent('HTMLEvents').constructor === window.Event");
19
20     // BeforeLoadEvent
21     shouldBeTrue("document.createEvent('BeforeLoadEvent') instanceof window.BeforeLoadEvent");
22     shouldBeTrue("document.createEvent('BeforeLoadEvent') instanceof window.Event");
23     shouldBeTrue("document.createEvent('BeforeLoadEvent').constructor === window.BeforeLoadEvent");
24
25     // CompositionEvent
26     shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.CompositionEvent");
27     shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.Event");
28     shouldBeTrue("document.createEvent('CompositionEvent').constructor === window.CompositionEvent");
29
30     // CustomEvent
31     shouldBeTrue("document.createEvent('CustomEvent') instanceof window.CustomEvent");
32     shouldBeTrue("document.createEvent('CustomEvent') instanceof window.Event");
33     shouldBeTrue("document.createEvent('CustomEvent').constructor === window.CustomEvent");
34
35     // ErrorEvent
36     shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.ErrorEvent");
37     shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.Event");
38     shouldBeTrue("document.createEvent('ErrorEvent').constructor === window.ErrorEvent");
39
40     // HashChangeEvent
41     shouldBeTrue("document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent");
42     shouldBeTrue("document.createEvent('HashChangeEvent') instanceof window.Event");
43     shouldBeTrue("document.createEvent('HashChangeEvent').constructor === window.HashChangeEvent");
44
45     // KeyboardEvent
46     shouldBeTrue("document.createEvent('KeyboardEvent') instanceof window.KeyboardEvent");
47     shouldBeTrue("document.createEvent('KeyboardEvent') instanceof window.UIEvent");
48     shouldBeTrue("document.createEvent('KeyboardEvent') instanceof window.Event");
49     shouldBeTrue("document.createEvent('KeyboardEvent').constructor === window.KeyboardEvent");
50
51     // KeyboardEvents (KeyboardEvent alternative)
52     shouldBeTrue("document.createEvent('KeyboardEvents') instanceof window.KeyboardEvent");
53     shouldBeTrue("document.createEvent('KeyboardEvents') instanceof window.UIEvent");
54     shouldBeTrue("document.createEvent('KeyboardEvents') instanceof window.Event");
55     shouldBeTrue("document.createEvent('KeyboardEvents').constructor === window.KeyboardEvent");
56
57     // MessageEvent
58     shouldBeTrue("document.createEvent('MessageEvent') instanceof window.MessageEvent");
59     shouldBeTrue("document.createEvent('MessageEvent') instanceof window.Event");
60     shouldBeTrue("document.createEvent('MessageEvent').constructor === window.MessageEvent");
61
62     // MouseEvent
63     shouldBeTrue("document.createEvent('MouseEvent') instanceof window.MouseEvent");
64     shouldBeTrue("document.createEvent('MouseEvent') instanceof window.UIEvent");
65     shouldBeTrue("document.createEvent('MouseEvent') instanceof window.Event");
66     shouldBeTrue("document.createEvent('MouseEvent').constructor === window.MouseEvent");
67
68     // MouseEvents (MouseEvent alternative)
69     shouldBeTrue("document.createEvent('MouseEvents') instanceof window.MouseEvent");
70     shouldBeTrue("document.createEvent('MouseEvents') instanceof window.UIEvent");
71     shouldBeTrue("document.createEvent('MouseEvents') instanceof window.Event");
72     shouldBeTrue("document.createEvent('MouseEvents').constructor === window.MouseEvent");
73
74     // MutationEvent
75     shouldBeTrue("document.createEvent('MutationEvent') instanceof window.MutationEvent");
76     shouldBeTrue("document.createEvent('MutationEvent') instanceof window.Event");
77     shouldBeTrue("document.createEvent('MutationEvent').constructor === window.MutationEvent");
78
79     // MutationEvents (MutationEvent alternative)
80     shouldBeTrue("document.createEvent('MutationEvents') instanceof window.MutationEvent");
81     shouldBeTrue("document.createEvent('MutationEvents') instanceof window.Event");
82     shouldBeTrue("document.createEvent('MutationEvents').constructor === window.MutationEvent");
83
84     // OverflowEvent
85     shouldBeTrue("document.createEvent('OverflowEvent') instanceof window.OverflowEvent");
86     shouldBeTrue("document.createEvent('OverflowEvent') instanceof window.Event");
87     shouldBeTrue("document.createEvent('OverflowEvent').constructor === window.OverflowEvent");
88
89     // PageTransitionEvent
90     shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.PageTransitionEvent");
91     shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.Event");
92     shouldBeTrue("document.createEvent('PageTransitionEvent').constructor === window.PageTransitionEvent");
93
94     // PopStateEvent
95     shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.PopStateEvent");
96     shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.Event");
97     shouldBeTrue("document.createEvent('PopStateEvent').constructor === window.PopStateEvent");
98
99     // ProgressEvent
100     shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.ProgressEvent");
101     shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.Event");
102     shouldBeTrue("document.createEvent('ProgressEvent').constructor === window.ProgressEvent");
103
104     // TextEvent
105     shouldBeTrue("document.createEvent('TextEvent') instanceof window.TextEvent");
106     shouldBeTrue("document.createEvent('TextEvent') instanceof window.UIEvent");
107     shouldBeTrue("document.createEvent('TextEvent') instanceof window.Event");
108     shouldBeTrue("document.createEvent('TextEvent').constructor === window.TextEvent");
109
110     // UIEvent
111     shouldBeTrue("document.createEvent('UIEvent') instanceof window.UIEvent");
112     shouldBeTrue("document.createEvent('UIEvent') instanceof window.Event");
113     shouldBeTrue("document.createEvent('UIEvent').constructor === window.UIEvent");
114
115     // UIEvents (UIEvent alternative)
116     shouldBeTrue("document.createEvent('UIEvents') instanceof window.UIEvent");
117     shouldBeTrue("document.createEvent('UIEvents') instanceof window.Event");
118     shouldBeTrue("document.createEvent('UIEvents').constructor === window.UIEvent");
119
120     // WebKitAnimationEvent
121     shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.WebKitAnimationEvent");
122     shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.Event");
123     shouldBeTrue("document.createEvent('WebKitAnimationEvent').constructor === window.WebKitAnimationEvent");
124
125     // WebKitTransitionEvent
126     shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.WebKitTransitionEvent");
127     shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.Event");
128     shouldBeTrue("document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent");
129
130     // WheelEvent
131     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.WheelEvent");
132     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.MouseEvent");
133     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.UIEvent");
134     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.Event");
135     shouldBeTrue("document.createEvent('WheelEvent').constructor === window.WheelEvent");
136
137     // XMLHttpRequestProgressEvent
138     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.XMLHttpRequestProgressEvent");
139     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.ProgressEvent");
140     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.Event");
141     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent').constructor === window.XMLHttpRequestProgressEvent");
142
143     // StorageEvent
144     shouldBeTrue("document.createEvent('StorageEvent') instanceof window.StorageEvent");
145     shouldBeTrue("document.createEvent('StorageEvent') instanceof window.Event");
146     shouldBeTrue("document.createEvent('StorageEvent').constructor === window.StorageEvent");
147
148     // #if ENABLE(SVG)
149     // SVGEvents (Event alternative)
150     shouldBeTrue("document.createEvent('SVGEvents') instanceof window.Event");
151     shouldBeTrue("document.createEvent('SVGEvents').constructor === window.Event");
152
153     // #if ENABLE(SVG)
154     // SVGZoomEvent
155     shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.SVGZoomEvent");
156     shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.Event");
157     shouldBeTrue("document.createEvent('SVGZoomEvent').constructor === window.SVGZoomEvent");
158
159     // #if ENABLE(SVG)
160     // SVGZoomEvents (SVGZoomEvent alternative)
161     shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.SVGZoomEvent");
162     shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.Event");
163     shouldBeTrue("document.createEvent('SVGZoomEvents').constructor === window.SVGZoomEvent");
164
165     // #if ENABLE(WEB_SOCKETS)
166     // CloseEvent
167     shouldBeTrue("document.createEvent('CloseEvent') instanceof window.CloseEvent");
168     shouldBeTrue("document.createEvent('CloseEvent') instanceof window.Event");
169     shouldBeTrue("document.createEvent('CloseEvent').constructor === window.CloseEvent");
170
171     // The following are here for completeness, but won't until there is more widespread support for them.
172
173     // #if ENABLE(WEB_AUDIO)
174     // AudioProcessingEvent
175     // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.AudioProcessingEvent");
176     // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.Event");
177     // shouldBeTrue("document.createEvent('AudioProcessingEvent').constructor === window.AudioProcessingEvent");
178
179     // #if ENABLE(WEB_AUDIO)
180     // OfflineAudioCompletionEvent
181     // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.OfflineAudioCompletionEvent");
182     // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.Event");
183     // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent').constructor === window.OfflineAudioCompletionEvent");
184
185     // #if ENABLE(INPUT_SPEECH)
186     // MediaStreamEvent
187     // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.MediaStreamEvent");
188     // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.Event");
189     // shouldBeTrue("document.createEvent('MediaStreamEvent').constructor === window.MediaStreamEvent");
190
191     // #if ENABLE(INPUT_SPEECH)
192     // SpeechInputEvent
193     // shouldBeTrue("document.createEvent('SpeechInputEvent') instanceof window.SpeechInputEvent");
194     // shouldBeTrue("document.createEvent('SpeechInputEvent') instanceof window.Event");
195     // shouldBeTrue("document.createEvent('SpeechInputEvent').constructor === window.SpeechInputEvent");
196
197     // #if ENABLE(WEBGL)
198     // WebGLContextEvent
199     // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.WebGLContextEvent");
200     // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.Event");
201     // shouldBeTrue("document.createEvent('WebGLContextEvent').constructor === window.WebGLContextEvent");
202
203     // #if ENABLE(TOUCH_EVENTS)
204     // TouchEvent
205     // shouldBeTrue("document.createEvent('TouchEvent') instanceof window.TouchEvent");
206     // shouldBeTrue("document.createEvent('TouchEvent') instanceof window.Event");
207     // shouldBeTrue("document.createEvent('TouchEvent').constructor === window.TouchEvent");
208
209     // #if ENABLE(DEVICE_ORIENTATION)
210     // DeviceMotionEvent
211     // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window.DeviceMotionEvent");
212     // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window.Event");
213     // shouldBeTrue("document.createEvent('DeviceMotionEvent').constructor === window.DeviceMotionEvent");
214
215     // #if ENABLE(DEVICE_ORIENTATION)
216     // DeviceOrientationEvent
217     // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof window.DeviceOrientationEvent");
218     // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof window.Event");
219     // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor === window.DeviceOrientationEvent");
220
221     // #if ENABLE(ORIENTATION_EVENTS)
222     // OrientationEvent (Event alternative)
223     // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.Event");
224     // shouldBeTrue("document.createEvent('OrientationEvent').constructor === window.Event");
225
226
227     // We test both a hard coded set and the automated set below (using enumeration) to ensure that a constructor being removed
228     // from the window is caught a regression.
229
230     var allEventInterfacesCreateEvents = true;
231     for (var propertyName in window) {
232         if (propertyName.match(/Event$/) && window[propertyName].toString().match(/EventConstructor\]$/)) {
233             try {
234                 if (!(document.createEvent(propertyName) instanceof window.Event)) {
235                     allEventInterfacesCreateEvents = false;
236                     debug("'document.createEvent(propertyName) instanceof window.Event' with propertyName: " + propertyName + " should be true but isn't");
237                 }
238             } catch (e) {
239                 allEventInterfacesCreateEvents = false;
240                 debug("'document.createEvent(propertyName) instanceof window.Event' with propertyName: " + propertyName + " threw an exception: " + e);
241             }
242
243             try {
244                 if (!(document.createEvent(propertyName) instanceof window[propertyName])) {
245                     allEventInterfacesCreateEvents = false;
246                     debug("'document.createEvent(propertyName) instanceof window[propertyName]' with propertyName: " + propertyName + " should be true but isn't");
247                 }
248             } catch (e) {
249                 allEventInterfacesCreateEvents = false;
250                 debug("'document.createEvent(propertyName) instanceof window[propertyName]' with propertyName: " + propertyName + " threw an exception: " + e);
251             }
252
253             try {
254                 if (!(document.createEvent(propertyName).constructor === window[propertyName])) {
255                     allEventInterfacesCreateEvents = false;
256                     debug("'document.createEvent(propertyName).constructor === window[propertyName]' with propertyName: " + propertyName + " should be true but isn't");
257                 }
258             } catch (e) {
259                 allEventInterfacesCreateEvents = false;
260                 debug("'document.createEvent(propertyName).constructor === window[propertyName]' with propertyName: " + propertyName + " threw an exception: " + e);
261             }
262         }
263     }
264     shouldBeTrue('allEventInterfacesCreateEvents');
265 </script>
266
267
268
269 <script src="../js/resources/js-test-post.js"></script>
270 </body>