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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/constructors/media-key-event-constructor.html

Issue 1712903002: Remove prefixed EME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix isRenewalMessage() in browser tests. Created 4 years, 10 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6
7 <body>
8 <script>
9
10 window.jsTestIsAsync = true;
11
12 description("This tests the constructor for the MediaKeyEvent DOM class. ");
13
14 function test()
15 {
16 debug("<br>*** No initializer passed ***");
17 shouldBe("new MediaKeyEvent('MediaKeyEvent').bubbles", "false");
18 shouldBe("new MediaKeyEvent('MediaKeyEvent').cancelable", "false");
19 shouldBeEmptyString("new MediaKeyEvent('MediaKeyEvent').keySystem");
20 shouldBeEmptyString("new MediaKeyEvent('MediaKeyEvent').sessionId");
21 shouldBeNull("new MediaKeyEvent('MediaKeyEvent').initData");
22 shouldBeNull("new MediaKeyEvent('MediaKeyEvent').message");
23 shouldBeEmptyString("new MediaKeyEvent('MediaKeyEvent').defaultURL") ;
24 shouldBeNull("new MediaKeyEvent('MediaKeyEvent').errorCode");
25 shouldBeZero("new MediaKeyEvent('MediaKeyEvent').systemCode");
26
27 debug("<br>*** Bubbles and cancelable true, other members are missin g ***");
28 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true }).bubbles", "true");
29 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true }).cancelable", "true");
30 shouldBeEmptyString("new MediaKeyEvent('MediaKeyEvent', { bubbles: t rue, cancelable: true }).keySystem");
31 shouldBeEmptyString("new MediaKeyEvent('MediaKeyEvent', { bubbles: t rue, cancelable: true }).sessionId");
32 shouldBeNull("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, ca ncelable: true }).initData");
33 shouldBeNull("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, ca ncelable: true }).message");
34 shouldBeEmptyString("new MediaKeyEvent('MediaKeyEvent', { bubbles: t rue, cancelable: true }).defaultURL");
35 shouldBeNull("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, ca ncelable: true }).errorCode");
36 shouldBeZero("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, ca ncelable: true }).systemCode");
37
38 debug("<br>*** Bubbles and cancelable true, invalid other members ** *");
39 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).bubbles");
40 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).cancelable");
41 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).keySystem");
42 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).sessionId");
43 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).initData");
44 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).message");
45 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).defaultURL");
46 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).errorCode");
47 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, can celable: true, keySystem: undefined, sessionId: undefined, initData: Uint8Array, message: Uint8Array, defaultURL: undefined, errorCode: MediaKeyError, systemCod e: undefined }).systemCode");
48
49 debug("<br>*** Initialize 'keySystem' with a invalid values ***");
50 emptyObject = { };
51 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { keySyste m: emptyObject }).keySystem", "[object Object]");
52 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { keySyste m: document }).keySystem", "[object HTMLDocument]");
53
54 debug("<br>*** Initialize 'sessionId' with a invalid values ***");
55 emptyObject = { };
56 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { sessionI d: emptyObject }).sessionId", "[object Object]");
57 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { sessionI d: document }).sessionId", "[object HTMLDocument]");
58
59 debug("<br>*** Initialize 'initData' with a invalid values ***");
60 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { initData: 10 }).in itData");
61 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { initData: \'string \' }).initData");
62 emptyObject = { };
63 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { initData: emptyObj ect }).initData");
64 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { initData: document }).initData");
65
66 debug("<br>*** Initialize 'message' with a invalid values ***");
67 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { message: 10 }).mes sage");
68 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { message: \'string\ ' }).message");
69 emptyObject = { };
70 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { message: emptyObje ct }).message");
71 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { message: document }).message");
72
73 debug("<br>*** Initialize 'defaultURL' with a invalid values ***");
74 emptyObject = { };
75 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { defaultU RL: emptyObject }).defaultURL", "[object Object]");
76 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { defaultU RL: document }).defaultURL", "[object HTMLDocument]");
77
78 debug("<br>*** Initialize 'errorCode' with a invalid values ***");
79 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { errorCode: 10 }).e rrorCode");
80 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { errorCode: \'strin g\' }).errorCode");
81 emptyObject = { };
82 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { errorCode: emptyOb ject }).errorCode");
83 shouldThrow("new MediaKeyEvent('MediaKeyEvent', { errorCode: documen t }).errorCode");
84
85 debug("<br>*** Initialize 'systemCode' with a invalid values ***");
86 shouldBeZero("new MediaKeyEvent('MediaKeyEvent', { systemCode: \'str ing\' }).systemCode");
87 emptyObject = { };
88 shouldBeZero("new MediaKeyEvent('MediaKeyEvent', { systemCode: empty Object }).systemCode");
89 shouldBeZero("new MediaKeyEvent('MediaKeyEvent', { systemCode: docum ent }).systemCode");
90
91 debug("<br>*** Bubbles and cancelable true, valid other members ***" );
92 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: initDataAr ray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObject, sy stemCode: 123 }).bubbles", "true");
93 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: initDataAr ray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObject, sy stemCode: 123 }).cancelable", "true");
94 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancelable: true, keySystem: 'keySystem', sessionId: 'sessionId', initDat a: initDataArray, message: messageArray, defaultURL: 'defaultURL', errorCode: er rorObject, systemCode: 123 }).keySystem", "keySystem");
95 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancelable: true, keySystem: 'keySystem', sessionId: 'sessionId', initDat a: initDataArray, message: messageArray, defaultURL: 'defaultURL', errorCode: er rorObject, systemCode: 123 }).sessionId", "sessionId");
96 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: initDataAr ray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObject, sy stemCode: 123 }).initData", "initDataArray");
97 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: initDataAr ray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObject, sy stemCode: 123 }).message", "messageArray");
98 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancelable: true, keySystem: 'keySystem', sessionId: 'sessionId', initDat a: initDataArray, message: messageArray, defaultURL: 'defaultURL', errorCode: er rorObject, systemCode: 123 }).defaultURL", "defaultURL");
99 // FIXME(82988): These two fail.
100 shouldBeNonNull("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancelable: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: ini tDataArray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObj ect, systemCode: 123 }).errorCode");
101 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: initDataAr ray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObject, sy stemCode: 123 }).errorCode.code", "MediaKeyError.MEDIA_KEYERR_UNKNOWN");
102 shouldBe("new MediaKeyEvent('MediaKeyEvent', { bubbles: true, cancel able: true, keySystem: 'keySystem', sessionId: 'sessionId', initData: initDataAr ray, message: messageArray, defaultURL: 'defaultURL', errorCode: errorObject, sy stemCode: 123 }).systemCode", "123");
103
104 debug("<br>*** Initialize with valid members ***");
105 shouldBe("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'keySystem ', sessionId: 'sessionId', initData: initDataArray, message: messageArray, defau ltURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).bubbles", "true" );
106 shouldBe("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'keySystem ', sessionId: 'sessionId', initData: initDataArray, message: messageArray, defau ltURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).cancelable", "tr ue");
107 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { keySyste m: 'keySystem', sessionId: 'sessionId', initData: initDataArray, message: messag eArray, defaultURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).key System", "keySystem");
108 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { keySyste m: 'keySystem', sessionId: 'sessionId', initData: initDataArray, message: messag eArray, defaultURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).ses sionId", "sessionId");
109 shouldBe("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'keySystem ', sessionId: 'sessionId', initData: initDataArray, message: messageArray, defau ltURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).initData", "init DataArray");
110 shouldBe("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'keySystem ', sessionId: 'sessionId', initData: initDataArray, message: messageArray, defau ltURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).message", "messa geArray");
111 shouldBeEqualToString("new MediaKeyEvent('MediaKeyEvent', { keySyste m: 'keySystem', sessionId: 'sessionId', initData: initDataArray, message: messag eArray, defaultURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).def aultURL", "defaultURL");
112 // FIXME(82988): These two fail.
113 shouldBeNonNull("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'ke ySystem', sessionId: 'sessionId', initData: initDataArray, message: messageArray , defaultURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).errorCode ");
114 shouldBe("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'keySystem ', sessionId: 'sessionId', initData: initDataArray, message: messageArray, defau ltURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).errorCode.code", "MediaKeyError.MEDIA_KEYERR_UNKNOWN");
115 shouldBe("new MediaKeyEvent('MediaKeyEvent', { keySystem: 'keySystem ', sessionId: 'sessionId', initData: initDataArray, message: messageArray, defau ltURL: 'defaultURL', errorCode: errorObject, systemCode: 123 }).systemCode", "12 3");
116
117 debug("");
118 finishJSTest();
119 }
120
121 var initDataArray = new Uint8Array([0x41, 0x42, 0x43]);
122 var messageArray = new Uint8Array([0x51, 0x52, 0x53]);
123 // FIXME(82988): This does not create an error like we want.
124 //var errorObject = window.MediaKeyError;
125 var errorObject = null;
126 // shouldBe("typeof errorObject", TBD);
127
128 video = document.createElement('video');
129 document.body.appendChild(video);
130
131 test()
132 </script>
133
134 </body>
135 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698