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

Unified Diff: third_party/WebKit/LayoutTests/media/media-can-play-type.html

Issue 2028463002: Convert media-can-* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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
Index: third_party/WebKit/LayoutTests/media/media-can-play-type.html
diff --git a/third_party/WebKit/LayoutTests/media/media-can-play-type.html b/third_party/WebKit/LayoutTests/media/media-can-play-type.html
index 3eb3dbc4bc92fa4182faa2fb8a9979ebda49ae1d..237ed181ea56b5a0cf5cc84f93d765305c50f6f2 100644
--- a/third_party/WebKit/LayoutTests/media/media-can-play-type.html
+++ b/third_party/WebKit/LayoutTests/media/media-can-play-type.html
@@ -1,29 +1,20 @@
<!DOCTYPE html>
-<html>
- <head>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src="video-test.js"></script>
- <script>
- function start() {
- video = document.getElementsByTagName('video')[0];
+<title>Test HTMLMediaElement's "canPlayType" method with invalid MIME types.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<video></video>
+<script>
+test(function() {
+ var video = document.querySelector("video");
- testException("video.canPlayType()", '"TypeError: Failed to execute \'canPlayType\' on \'HTMLMediaElement\': 1 argument required, but only 0 present."');
- testExpected("video.canPlayType('video/')", "");
- testExpected("video.canPlayType('video/blahblah')", "");
- testExpected("video.canPlayType('video/blahblah; codecs=\"blah, , blah\"')", "");
- testExpected("video.canPlayType('video/blahblah; codecs=blah')", "");
- testExpected("video.canPlayType('video/blahblah; codecs=\"blah\"')", "");
- testExpected("video.canPlayType('video/blahblah; codecs=\"badcontent')", "");
- testExpected("video.canPlayType('video/blahblah; codecs=badcontent\"')", "");
- testExpected("video.canPlayType('video/blahblah; codecs=&quot;badcontent&quot;')", "");
-
- endTest();
- }
- </script>
- </head>
- <body onload="start()">
- <video controls></video>
- <p>Test HTMLMediaElement <em>canPlayType()</em> method.</p>
- </body>
-</html>
+ assert_throws(new TypeError, function() { video.canPlayType(); });
+ assert_equals(video.canPlayType("video/"), "");
+ assert_equals(video.canPlayType("video/blahblah"), "");
+ assert_equals(video.canPlayType("video/blahblah; codecs=\"blah, , blah\""), "");
+ assert_equals(video.canPlayType("video/blahblah; codecs=blah"), "");
+ assert_equals(video.canPlayType("video/blahblah; codecs=\"blah\""), "");
+ assert_equals(video.canPlayType("video/blahblah; codecs=\"badcontent"), "");
+ assert_equals(video.canPlayType("video/blahblah; codecs=badcontent\""), "");
+ assert_equals(video.canPlayType("video/blahblah; codecs=&quot;badcontent&quot;"), "");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698