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

Unified Diff: third_party/WebKit/LayoutTests/media/video-src-empty.html

Issue 2092373002: Convert video-src* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/video-src-empty.html
diff --git a/third_party/WebKit/LayoutTests/media/video-src-empty.html b/third_party/WebKit/LayoutTests/media/video-src-empty.html
index 06d62385b3ef3155cea7cd17deb6b3996bd681ad..f75a6639b330e09653cc2a7850571f8fdd9b2b50 100644
--- a/third_party/WebKit/LayoutTests/media/video-src-empty.html
+++ b/third_party/WebKit/LayoutTests/media/video-src-empty.html
@@ -1,45 +1,31 @@
<!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 src=media-file.js></script>
- <script>
+<title>Video element with src="" should invoke media element's load algorithm and should fire "error" event. Network state should be NETWORK_NO_SOURCE and the error code should be MEDIA_ERR_SRC_NOT_SUPPORTED.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
- function start()
- {
- findMediaElement();
+ video.onloadstart = t.step_func(function() {});
+ video.onloadedmetadata = t.step_func(function() {});
+ video.onloadeddata = t.step_func(function() {});
+ video.onabort = t.step_func(function() {});
+ video.onemptied = t.step_func(function() {});
+ video.onerror = t.unreached_func();
- waitForEvent("loadstart");
- waitForEvent("loadedmetadata");
- waitForEvent("loadeddata");
- waitForEvent("abort");
- waitForEvent("emptied");
- waitForEvent("canplaythrough", testLoad);
- waitForEvent("error", errorEvent);
- consoleWrite("** &lt;video&gt; with valid non-empty 'src' attribute**");
- video.src = findMediaFile("video", "content/test");
- }
+ video.oncanplaythrough = t.step_func(function() {
+ // video with empty src attribute.
+ video.src = "";
+ video.onerror = t.step_func_done(function(event) {
+ assert_equals(event.target, video);
+ assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
+ assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
+ });
+ });
- function errorEvent()
- {
- consoleWrite("<br>'error' event:");
- testExpected('event.target', video);
- testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
- testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
- endTest();
- }
-
- function testLoad()
- {
- consoleWrite("<br>** &lt;video&gt; with empty src attribute**");
- run('video.src = ""');
- }
- </script>
- </head>
- <body onload="start()">
- <video width=320 height=60 controls></video>
- <p> &lt;video&gt; element with src="" should invoke media element's load algorithm and should fire 'error' event. Network state should be NETWORK_NO_SOURCE and set error to MEDIA_ERR_SRC_NOT_SUPPORTED.</p>
- </body>
-</html>
+ // video with valid non-empty "src" attribute.
+ video.src = findMediaFile("video", "content/test");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698