Title: [288221] trunk/LayoutTests
- Revision
- 288221
- Author
- [email protected]
- Date
- 2022-01-19 11:44:17 -0800 (Wed, 19 Jan 2022)
Log Message
Add a data URL resource loader performance test
https://bugs.webkit.org/show_bug.cgi?id=235325
Reviewed by Eric Carlson.
This patch is a follow-up of r287899. In local tests, the time taken
by a video element to load a data URL is about 2x of the time to load
the binary form of the media file.
* media/video-src-blob-perf-expected.txt: Added.
* media/video-src-blob-perf.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (288220 => 288221)
--- trunk/LayoutTests/ChangeLog 2022-01-19 19:41:50 UTC (rev 288220)
+++ trunk/LayoutTests/ChangeLog 2022-01-19 19:44:17 UTC (rev 288221)
@@ -1,3 +1,17 @@
+2022-01-19 Peng Liu <[email protected]>
+
+ Add a data URL resource loader performance test
+ https://bugs.webkit.org/show_bug.cgi?id=235325
+
+ Reviewed by Eric Carlson.
+
+ This patch is a follow-up of r287899. In local tests, the time taken
+ by a video element to load a data URL is about 2x of the time to load
+ the binary form of the media file.
+
+ * media/video-src-blob-perf-expected.txt: Added.
+ * media/video-src-blob-perf.html: Added.
+
2022-01-19 Rob Buis <[email protected]>
Null check player in taintsOrigin
Added: trunk/LayoutTests/media/video-src-blob-perf-expected.txt (0 => 288221)
--- trunk/LayoutTests/media/video-src-blob-perf-expected.txt (rev 0)
+++ trunk/LayoutTests/media/video-src-blob-perf-expected.txt 2022-01-19 19:44:17 UTC (rev 288221)
@@ -0,0 +1,4 @@
+This tests that a video element loads a blob URL in a reasonable amount of time (should be shorter than 5x of the time to load the binary form of the media file).
+
+END OF TEST
+
Added: trunk/LayoutTests/media/video-src-blob-perf.html (0 => 288221)
--- trunk/LayoutTests/media/video-src-blob-perf.html (rev 0)
+++ trunk/LayoutTests/media/video-src-blob-perf.html 2022-01-19 19:44:17 UTC (rev 288221)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+ var canplaythrough1 = false;
+ var canplaythrough2 = false;
+ var start1 = 0;
+ var start2 = 0;
+ var delta1 = 0;
+ var delta2 = 0;
+
+ function checkElementState() {
+ if (canplaythrough1 && canplaythrough2) {
+ if (delta1 * 5 > delta2)
+ endTest();
+ else
+ failTest("Loading a data URL takes too long time. delta1 = " + delta1 + ", delta2 = " + delta2 + ".");
+ }
+ }
+
+ function runTest() {
+ const videos = document.querySelectorAll('video');
+ const video1 = videos[0];
+ const video2 = videos[1];
+
+ const url = "" "content/long-test");
+
+ video1._oncanplaythrough_ = () => {
+ canplaythrough1 = true;
+ delta1 = Date.now() - start1;
+ checkElementState();
+ }
+
+ video2._oncanplaythrough_ = () => {
+ canplaythrough2 = true;
+ delta2 = Date.now() - start2;
+ checkElementState();
+ }
+
+ const request = new XMLHttpRequest();
+ request.open('GET', url, true);
+ request.responseType = 'blob';
+
+ request._onload_ = () => {
+ const reader = new FileReader();
+ reader._onload_ = event => {
+ const createdDataUrl = event.target.result;
+ video2.src = ""
+ video1.src = ""
+
+ const now = Date.now();
+ start1 = now;
+ start2 = now;
+ };
+ reader.readAsDataURL(request.response);
+ };
+ request.send();
+
+ setTimeout(() => failTest("Cannot complete the test in 10 seconds."), 10000);
+ }
+ </script>
+ </head>
+ <body _onload_="runTest()">
+ <div>
+ This tests that a video element loads a blob URL in a reasonable amount of time (should be shorter than 5x of the time to load the binary form of the media file).
+ </div>
+ <video controls></video>
+ <video controls></video>
+ </body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes