Skip to content

Commit

Permalink
Import video-cancel-load.html from Blink / Chromium
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=269171

Reviewed by Eric Carlson.

This patch is to import test from Blink, which was updated:

Partial Merge: https://source.chromium.org/chromium/chromium/src/+/25f67c81bfa8c6b1ce5a4c061ca5bd76eae32fff

* LayoutTests/http/tests/media/video-cancel-load.html: Update Test Case
* LayoutTests/http/tests/media/video-cancel-load-expected.txt: Add Test Case Expectation

> It requires Back/Forward Test Runner flag and it seems to not work
on WPE & GTK platform and previously it had `empty` line as expectation
as well. So it keeps similar for GTK & WPE.

* LayoutTests/platform/glib/http/tests/media/video-cancel-load-expected.txt: Add Platform Specific Test Expectation

Canonical link: https://commits.webkit.org/274925@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Feb 17, 2024
1 parent 0cb4c5d commit 9099761
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 46 deletions.
3 changes: 3 additions & 0 deletions LayoutTests/http/tests/media/video-cancel-load-expected.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@


PASS Test that progress events are generated during loading of media resource.

84 changes: 38 additions & 46 deletions LayoutTests/http/tests/media/video-cancel-load.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
<html>
<head>
<title>Cancel loading a video file and access its properties afterwards.</title>
</head>
<body>
Access a video element with resource loading canceled.
If this test is successful it will terminate with a blank page.
This test should finish without crashing.
<!DOCTYPE html><!-- webkit-test-runner [ JavaScriptCanOpenWindowsAutomatically=true ] -->
<title>Cancel loading a video file and access its properties afterwards.</title>
<video></video>

<script src=../../media-resources/media-file.js></script>
<script src=../../media-resources/video-test.js></script>
<video controls id="video"></video>
<textarea style="display: none;">
<!-- Begin child content -->
<!-- The following section contains the content in the document of child window. -->
<script>
var video = window.opener.video;
window.setTimeout(function() {
var d = video.duration;
testRunner.notifyDone();
}, 50);
window.opener.blank();
</script>
<!-- End child content -->
</textarea>

<textarea id="child_content" style="display: none;">
<!-- Begin child content -->
<!-- The following section contains the content in the document of child window. -->
<script>
var video = window.opener.video;
window.setTimeout(function () {
var d = video.duration;
if (window.testRunner)
testRunner.notifyDone();
}, 50);
window.opener.blank();
</script>
<!-- End child content -->
</textarea>
<script>
// Access a video element with resource loading canceled.
// If this test is successful it will terminate with a blank page.
// This test should finish without crashing.
testRunner.dumpAsText();

<script>
var video = document.getElementById("video");
var file = findMediaFile("video", "../resources/test");
var video = document.querySelector("video");

// Opens a window and writes the child content into the document.
video.addEventListener("loadedmetadata", function main()
{
var win = window.open("", "child");
var doc = win.document;
doc.open();
doc.write(document.getElementById("child_content").value);
doc.close();
});
video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?throttle=40&name=" + file;
// Opens a window and writes the child content into the document.
video.onloadedmetadata = function() {
var win = window.open("", "child");
var doc = win.document;
doc.open();
doc.write(document.querySelector("textarea").value);
doc.close();
};

// Change URL of the current page to a blank page.
function blank()
{
location.href = "about:blank";
}
</script>
</body>
</html>
var file = "resources/test.mp4";
video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?throttle=40&name=" + file;

// Change URL of the current page to a blank page.
function blank() {
location.href = "about:blank";
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 9099761

Please sign in to comment.