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/http/tests/media/reload-after-dialog.html

Issue 2258863002: Convert http media tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 4 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/http/tests/media/reload-after-dialog.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html b/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html
index fda0149e52af01b4c488e19ceff73b24dab14e4f..c6518f1157b2d176b2dde5e5f3f8e352d280a908 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html
@@ -1,66 +1,27 @@
<!DOCTYPE html>
-<html>
- <head>
- <script src=../../media-resources/media-file.js></script>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src=../../media-resources/video-test.js></script>
- <script>
- var loadCount = 0;
-
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
- function logEvent(event)
- {
- consoleWrite("<br><b><em>'" + event.type + "'<" + "/em> event<" + "/b>");
- }
-
- function loadstart()
- {
- logEvent(event);
-
- if (++loadCount > 1) {
- consoleWrite('FAIL: loadstart fired more than once.');
- endTest();
- return;
- }
-
- consoleWrite("*** Showing confirm dialog...");
- confirm('I hope the movie continues to play!');
- }
-
- function canplaythrough()
- {
- logEvent(event);
-
- consoleWrite("");
- endTest();
- }
-
- function setup()
- {
- logEvent(event);
- consoleWrite("*** Setting up element...");
-
- findMediaElement();
- var movie = findMediaFile("video", "../resources/test");
- video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=100";
- }
-
- </script>
- </head>
-
- <body onload="setup()">
- <video controls
- oncanplaythrough="canplaythrough()"
- onloadstart="loadstart()">
- </video>
- <p>Make sure we don't reload a &lt;video&gt; element after a dialog is shown.<br>
- Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br>
- handler is called. If the movie is reloaded when the dialog is "dismissed", another <br>
- 'loadstart' event will be fired</p>
- </body>
-</html>
+<title>Test that video is not reloaded on showing a dialog.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<video></video>
+<script>
+// Make sure we don't reload a "video" element after a dialog is shown.
+// Test this by loading a movie slowly and showing a dialog when a
+// "loadstart" event handler is called. If the movie is reloaded when
+// the dialog is "dismissed", another "loadstart" event will be fired.
+async_test(function(t) {
+ var movie = findMediaFile("video", "../resources/test");
+ var video = document.querySelector("video");
+
+ video.onloadstart = t.step_func(function() {
+ video.onloadstart = t.unreached_func();
+
+ // Showing confirm dialog.
+ confirm("I hope the movie continues to play!");
+ });
+
+ video.oncanplaythrough = t.step_func_done();
+
+ video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=100";
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698