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

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: Remove text attribute Created 6 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/media/track/track-datacue-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 testExceptionType("cue.data = null", "TypeError");
46 testExceptionType("cue.data = 'test'", "TypeError");
47 testExceptionType("cue.data = [5]", "TypeError");
48 testExceptionType("badCue = new DataCue(1, 2, null)", "TypeError ");
49 testExceptionType("badCue = new DataCue(1, 2, 'test')", "TypeErr or");
50 testExceptionType("badCue = new DataCue(1, 2, [5])", "TypeError" );
51 testExceptionType("badCue = new DataCue(NaN, 2, expectedData.buf fer)", "TypeError");
52 testExceptionType("badCue = new DataCue(1, NaN, expectedData.buf fer)", "TypeError");
53
54 consoleWrite("<br>*** Test adding DataCue to track with kind = ' metadata'.");
55 var video = document.createElement("video");
56 metadataTrack = video.addTextTrack("metadata");
57 metadataTrack.addCue(cue);
58
59 testExpected("cue.track", metadataTrack);
60 testExpected("metadataTrack.cues[0]", cue);
61
62 consoleWrite("<br>*** Test adding DataCue to track with kind != 'metadata'.");
63 ["subtitles", "captions", "descriptions", "chapters"].forEach(fu nction(kind) {
64 track = video.addTextTrack(kind);
65 track.addCue(cue);
66 testExpected("cue.track", track);
67 testExpected("track.cues[0]", cue);
68 });
69
70 endTest();
71 }
72 </script>
73 </head>
74 <body onload="loaded()">
75 <p>Tests DataCue interface</p>
76 </body>
77 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/track/track-datacue-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698