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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-cue-empty-crash.html

Issue 1882583002: Convert track tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/track/track-cue-empty-crash.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-empty-crash.html b/third_party/WebKit/LayoutTests/media/track/track-cue-empty-crash.html
index 3c6ad4d61d2b8b8fd2dfbd7b93440d15c03146d0..e7869cfb510bac48bf5ecee1c83b597827e10727 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-empty-crash.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-cue-empty-crash.html
@@ -1,36 +1,19 @@
<!DOCTYPE html>
-<html>
- <head>
- <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>
- var fragment;
- function startTest()
- {
- var emptyCue = new VTTCue(0, 0, "");
- fragment = emptyCue.getCueAsHTML();
+<title>Tests that having an empty cue does not crash when calling getCueAsHTML().</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var emptyCue = new VTTCue(0, 0, "");
+ var fragment = emptyCue.getCueAsHTML();
- consoleWrite("** The getCueAsHTML() method should return a document fragment **");
- testExpected("fragment", null, "!=");
+ // The getCueAsHTML() method should return a document fragment.
+ assert_true(fragment instanceof DocumentFragment);
- consoleWrite("<br>** The document fragment should have one child, an empty Text node **");
- testExpected("fragment.childNodes.length", 1);
- testExpected("fragment.childNodes[0].constructor.name", Text.name);
- testExpected("fragment.childNodes[0].length", 0);
-
- consoleWrite("");
- consoleWrite("No crash. PASS.");
- consoleWrite("");
-
- endTest();
- }
- </script>
- </head>
-
- <body onload="startTest()">
- <p>Tests that having an empty cue does not crash when calling getCueAsHTML().</p>
- <video controls />
- </body>
-</html>
+ // The document fragment should have one child, an empty Text node.
+ assert_equals(fragment.childNodes.length, 1);
+ assert_equals(fragment.childNodes[0].constructor.name, Text.name);
+ assert_equals(fragment.childNodes[0].length, 0);
+ assert_equals(fragment.childNodes[0].data, "");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698