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

Unified Diff: third_party/WebKit/LayoutTests/media/video-preload-datasaver.html

Issue 2071793003: Use data saver information to decide whether to preload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay-visibility
Patch Set: keep connection check 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/video-preload-datasaver.html
diff --git a/third_party/WebKit/LayoutTests/media/video-preload-datasaver.html b/third_party/WebKit/LayoutTests/media/video-preload-datasaver.html
new file mode 100644
index 0000000000000000000000000000000000000000..4bfac6058cd3f996551d48b443ec04ce24f1cf61
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/video-preload-datasaver.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Test preload behaviour with data saver setting</title>
+</head>
+<body>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<script>
+ window.internals.settings.setDataSaverEnabled(true);
+
+ async_test(function(t) {
+ var v = document.createElement('video');
+ v.src = findMediaFile('video', 'content/test');
+
+ assert_equals(v.preload, 'none');
+ v.onsuspend = t.step_func_done();
+ v.onprogress = t.unreached_func();
+ }, "Data saver makes the default preload value to 'none'.");
+
+ async_test(function(t) {
+ var v = document.createElement('video');
+ v.src = findMediaFile('video', 'content/test');
+ v.preload = 'metadata';
+
+ assert_equals(v.preload, 'none');
+ v.onsuspend = t.step_func_done();
+ v.onprogress = t.unreached_func();
+ }, "Data saver overrides preload='metadata'.");
+
+ async_test(function(t) {
+ var v = document.createElement('video');
+ v.src = findMediaFile('video', 'content/test');
+ v.preload = 'auto';
+
+ assert_equals(v.preload, 'none');
+ v.onsuspend = t.step_func_done();
+ v.onprogress = t.unreached_func();
+ }, "Data saver overrides preload='auto'.");
+
+ async_test(function(t) {
+ window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
+
+ var v = document.createElement('video');
+ v.autoplay = true;
+ v.src = findMediaFile('video', 'content/test');
+
+ assert_equals(v.preload, 'none');
+ v.onsuspend = t.step_func_done();
+ v.onprogress = t.unreached_func();
+
+ t.add_cleanup(function() {
+ window.internals.settings.setMediaPlaybackRequiresUserGesture(false);
+ });
+ }, "Data saver prevents loading autoplaying videos when autoplay is blocked.");
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698