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

Side by Side Diff: LayoutTests/media/track/track-datacue.html

Issue 224833002: Implement DataCue interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
6 <script src=../media-file.js></script>
7 <script src=../video-test.js></script>
8 <script>
9 function loaded()
10 {
11 expectedData = new Uint8Array([4, 5, 2, 1, 9]);
12 cue = new DataCue(3, 10, expectedData.buffer);
13
14 consoleWrite("<br>*** Test DataCue's TextTrackCue interface.");
15 testExpected("cue", TextTrackCue, "instanceof");
16 testExpected("cue.track", null);
17 testExpected("cue.id", "");
18 testExpected("cue.startTime", 3);
19 testExpected("cue.endTime", 10);
20 testExpected("cue.pauseOnExit", false);
21
22 consoleWrite("<br>*** Test DataCue interface.");
23 testExpected("cue", DataCue, "instanceof");
24 testArraysEqual("new Uint8Array(cue.data)", expectedData);
25 testExpected("cue.text", null);
26
27 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=24687
28 consoleWrite("<br>*** Changing the original buffer data should n ot effect DataCue.data.");
29
30 // Passing data to constructor then changing the original buffer
31 run("expectedData[0] = 7");
32 testExpected("new Uint8Array(cue.data)[0]", 4);
33
34 // Setting .data then changing the original buffer
35 run("cue.data = expectedData.buffer");
36 testExpected("new Uint8Array(cue.data)[0]", 7);
37 run("expectedData[0] = 11");
38 testExpected("new Uint8Array(cue.data)[0]", 7);
39
40 // Getting .data then changing the original buffer
41 run("new Uint8Array(cue.data)[0] = 8");
42 testExpected("(new Uint8Array(cue.data))[0]", 7);
43
44 consoleWrite("<br>*** Throw exception if data is not an ArrayBuf fer.");
45 var error = "'TypeError: Type error'";
46 testDOMException("cue.data = null", "DOMException.INVALID_NODE_T YPE_ERR");
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 Shouldn't all these invalid assignments be TypeErr
47 testDOMException("cue.data = 'test'", "DOMException.INVALID_NODE _TYPE_ERR");
48 testDOMException("cue.data = [5]", "DOMException.INVALID_NODE_TY PE_ERR");
49 testDOMException("badCue = new DataCue(1, 2, null)", "DOMExcepti on.INVALID_NODE_TYPE_ERR");
50 testDOMException("badCue = new DataCue(1, 2, 'test')", "DOMExcep tion.INVALID_NODE_TYPE_ERR");
51 testDOMException("badCue = new DataCue(1, 2, [5])", "DOMExceptio n.INVALID_NODE_TYPE_ERR");
52
53 consoleWrite("<br>*** Test adding DataCue to track with kind = ' metadata'.");
54 var video = document.createElement("video");
55 metadataTrack = video.addTextTrack("metadata");
56 metadataTrack.addCue(cue);
57
58 testExpected("cue.track", metadataTrack);
59 testExpected("metadataTrack.cues[0]", cue);
60
61 consoleWrite("<br>*** Test adding DataCue to track with kind != 'metadata'.");
62 ["subtitles", "captions", "descriptions", "chapters"].forEach(fu nction(kind) {
63 track = video.addTextTrack(kind);
64
65 testDOMException("track.addCue(cue)", "DOMException.INVALID_ NODE_TYPE_ERR");
66 testExpected("track.cues.length", 0);
67 });
68
69 endTest();
70 }
71 </script>
72 </head>
73 <body onload="loaded()">
74 <p>Tests DataCue interface</p>
75 </body>
76 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/track/track-datacue-expected.txt » ('j') | LayoutTests/media/video-test.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698