Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html |
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html b/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html |
| index d7088c8d5555d35ccbeac0ab255bf8e814bc37a5..e5fe272e4d8a40c34cf0f245b777e9104e0da552 100644 |
| --- a/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html |
| +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-mutable-text.html |
| @@ -1,42 +1,43 @@ |
| <!DOCTYPE html> |
| -<html> |
| - <head> |
| - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| - |
| - <script src=../media-file.js></script> |
| - <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| - <script src=../video-test.js></script> |
| - <script src=../media-controls.js></script> |
| - |
| - <script> |
| - |
| - var testTrack; |
| - var fragment; |
| - |
| - function testMutability() |
| - { |
| - consoleWrite("<br>** Test initial cue info"); |
| - |
| - testExpected("testTrack.track.activeCues.length", 0); |
| - testExpected("textTrackDisplayElement(video, 'display').innerText", ""); |
|
Srirama
2016/04/13 12:37:12
Removed this intentionally, because this is throwi
mlamouri (slow - plz ping)
2016/04/13 13:05:00
Could you be more specific?
Srirama
2016/04/13 13:10:03
When we call "textTrackDisplayElement(video, 'disp
Srirama
2016/04/13 13:23:23
My intention in removing it is that the activeCues
|
| - |
| - testExpected("testTrack.track.cues[0].startTime", 1.0); |
| - testExpected("testTrack.track.cues[1].startTime", 3.0); |
| - |
| - testExpected("testTrack.track.cues[0].text", "Lorem ipsum dolor sit amet,"); |
| - fragment = document.createDocumentFragment(); |
| +<title>Test that cue text is mutable.</title> |
| +<script src="../media-file.js"></script> |
| +<script src="../media-controls.js"></script> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<video> |
| + <track src="captions-webvtt/captions-gaps.vtt" kind="captions" default > |
| +</video> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| + var testTrack = document.querySelector("track"); |
| + |
| + video.oncanplaythrough = t.step_func(testMutability); |
| + testTrack.onload = t.step_func(testMutability); |
| + |
| + var eventCount = 0; |
| + function testMutability() { |
| + eventCount++; |
| + if (eventCount == 2) { |
|
mlamouri (slow - plz ping)
2016/04/13 13:05:00
I think this will allow you to save some indentati
Srirama
2016/04/13 13:10:03
Acknowledged.
Srirama
2016/04/13 13:34:30
Done.
|
| + // Test initial cue info. |
| + assert_equals(testTrack.track.activeCues.length, 0); |
| + |
| + assert_equals(testTrack.track.cues[0].startTime, 1.0); |
| + assert_equals(testTrack.track.cues[1].startTime, 3.0); |
| + |
| + assert_equals(testTrack.track.cues[0].text, "Lorem ipsum dolor sit amet,"); |
| + var fragment = document.createDocumentFragment(); |
| fragment.appendChild(document.createTextNode("Lorem ipsum dolor sit amet,")); |
| - testExpected("fragment.isEqualNode(testTrack.track.cues[0].getCueAsHTML())", true); |
| + assert_true(fragment.isEqualNode(testTrack.track.cues[0].getCueAsHTML())); |
| - consoleWrite("<br>** Change the start time of cue #1, it should become visible."); |
| - run("testTrack.track.cues[0].startTime = 0"); |
| - testExpected("testTrack.track.cues[0].startTime", 0); |
| - testExpected("textTrackDisplayElement(video, 'display').innerText", "Lorem ipsum dolor sit amet,"); |
| + // Change the start time of cue #1, it should become visible. |
| + testTrack.track.cues[0].startTime = 0; |
| + assert_equals(testTrack.track.cues[0].startTime, 0); |
| + assert_equals(textTrackDisplayElement(video, "display").innerText, "Lorem ipsum dolor sit amet,"); |
| - consoleWrite("<br>** Change the cue text, getCueAsHTML() should return a new, correct fragment."); |
| - run("testTrack.track.cues[0].text = 'Lorem <b>ipsum</b> <u>dolor</u> <i.sit>sit</i> amet,'"); |
| - testExpected("testTrack.track.cues[0].text", "Lorem <b>ipsum</b> <u>dolor</u> <i.sit>sit</i> amet,"); |
| + // Change the cue text, getCueAsHTML() should return a new, correct fragment. |
| + testTrack.track.cues[0].text = "Lorem <b>ipsum</b> <u>dolor</u> <i.sit>sit</i> amet,"; |
| + assert_equals(testTrack.track.cues[0].text, "Lorem <b>ipsum</b> <u>dolor</u> <i.sit>sit</i> amet,"); |
| fragment = document.createDocumentFragment(); |
| fragment.appendChild(document.createTextNode("Lorem ")); |
| @@ -60,28 +61,12 @@ |
| fragment.appendChild(document.createTextNode(" amet,")); |
| - testExpected("fragment.isEqualNode(testTrack.track.cues[0].getCueAsHTML())", true); |
| - |
| - consoleWrite(""); |
| - endTest(); |
| - } |
| - |
| - function loaded() |
| - { |
| - findMediaElement(); |
| - testTrack = document.querySelector('track'); |
| - |
| - waitForEventsAndCall([[video, 'canplaythrough'], [testTrack, 'load']], testMutability); |
| + assert_true(fragment.isEqualNode(testTrack.track.cues[0].getCueAsHTML())); |
| - video.src = findMediaFile('video', '../content/counting'); |
| + t.done(); |
| } |
| + } |
| - </script> |
| - </head> |
| - <body onload="loaded()"> |
| - <video controls > |
| - <track src="captions-webvtt/captions-gaps.vtt" kind="captions" default > |
| - </video> |
| - <p>Test that cue text is mutable.</p> |
| - </body> |
| -</html> |
| + video.src = findMediaFile("video", "../content/counting"); |
| +}); |
| +</script> |