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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/media/track/track-datacue-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/track/track-datacue.html
diff --git a/LayoutTests/media/track/track-datacue.html b/LayoutTests/media/track/track-datacue.html
new file mode 100644
index 0000000000000000000000000000000000000000..24c229423963e73b662fe6678c26a0af8328d709
--- /dev/null
+++ b/LayoutTests/media/track/track-datacue.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <script src=../media-file.js></script>
+ <script src=../video-test.js></script>
+ <script>
+ function loaded()
+ {
+ expectedData = new Uint8Array([4, 5, 2, 1, 9]);
+ cue = new DataCue(3, 10, expectedData.buffer);
+
+ consoleWrite("<br>*** Test DataCue's TextTrackCue interface.");
+ testExpected("cue", TextTrackCue, "instanceof");
+ testExpected("cue.track", null);
+ testExpected("cue.id", "");
+ testExpected("cue.startTime", 3);
+ testExpected("cue.endTime", 10);
+ testExpected("cue.pauseOnExit", false);
+
+ consoleWrite("<br>*** Test DataCue interface.");
+ testExpected("cue", DataCue, "instanceof");
+ testArraysEqual("new Uint8Array(cue.data)", expectedData);
+ testExpected("cue.text", null);
+
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=24687
+ consoleWrite("<br>*** Changing the original buffer data should not effect DataCue.data.");
+
+ // Passing data to constructor then changing the original buffer
+ run("expectedData[0] = 7");
+ testExpected("new Uint8Array(cue.data)[0]", 4);
+
+ // Setting .data then changing the original buffer
+ run("cue.data = expectedData.buffer");
+ testExpected("new Uint8Array(cue.data)[0]", 7);
+ run("expectedData[0] = 11");
+ testExpected("new Uint8Array(cue.data)[0]", 7);
+
+ // Getting .data then changing the original buffer
+ run("new Uint8Array(cue.data)[0] = 8");
+ testExpected("(new Uint8Array(cue.data))[0]", 7);
+
+ consoleWrite("<br>*** Throw exception if data is not an ArrayBuffer.");
+ testExceptionType("cue.data = null", "TypeError");
+ testExceptionType("cue.data = 'test'", "TypeError");
+ testExceptionType("cue.data = [5]", "TypeError");
+ testExceptionType("badCue = new DataCue(1, 2, null)", "TypeError");
+ testExceptionType("badCue = new DataCue(1, 2, 'test')", "TypeError");
+ testExceptionType("badCue = new DataCue(1, 2, [5])", "TypeError");
+ testExceptionType("badCue = new DataCue(NaN, 2, expectedData.buffer)", "TypeError");
+ testExceptionType("badCue = new DataCue(1, NaN, expectedData.buffer)", "TypeError");
+
+ consoleWrite("<br>*** Test adding DataCue to track with kind = 'metadata'.");
+ var video = document.createElement("video");
+ metadataTrack = video.addTextTrack("metadata");
+ metadataTrack.addCue(cue);
+
+ testExpected("cue.track", metadataTrack);
+ testExpected("metadataTrack.cues[0]", cue);
+
+ consoleWrite("<br>*** Test adding DataCue to track with kind != 'metadata'.");
+ ["subtitles", "captions", "descriptions", "chapters"].forEach(function(kind) {
+ track = video.addTextTrack(kind);
+ track.addCue(cue);
+ testExpected("cue.track", track);
+ testExpected("track.cues[0]", cue);
+ });
+
+ endTest();
+ }
+ </script>
+ </head>
+ <body onload="loaded()">
+ <p>Tests DataCue interface</p>
+ </body>
+</html>
« 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