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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/misc/client-hints-accept-meta.html

Issue 2860093003: Implement device-ram client hints header (Closed)
Patch Set: Rebase UseCounter.h Created 3 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width"> 2 <meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width, Device-RAM">
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <body> 5 <body>
6 <script> 6 <script>
7 var t = async_test('Client-Hints sent when Accept-CH header is present') ; 7 var t = async_test('Client-Hints sent when Accept-CH header is present') ;
8 var unreached = function() { 8 var unreached = function() {
9 assert_unreached("Image should have loaded."); 9 assert_unreached("Image should have loaded.");
10 }; 10 };
11 11
12 var loadDeviceRAMImage = function() {
13 var img = new Image();
14 img.src = 'resources/image-checks-for-device-ram.php';
15 img.onload = t.step_func(function(){ t.done(); });
16 img.onerror = t.step_func(unreached);
17 document.body.appendChild(img);
18 };
12 var loadRWImage = function() { 19 var loadRWImage = function() {
13 var img = new Image(); 20 var img = new Image();
14 img.src = 'resources/image-checks-for-width.php'; 21 img.src = 'resources/image-checks-for-width.php';
15 img.sizes = '100vw'; 22 img.sizes = '100vw';
16 img.onload = t.step_func(function(){ t.done(); }); 23 img.onload = t.step_func(loadDeviceRAMImage);
17 img.onerror = t.step_func(unreached); 24 img.onerror = t.step_func(unreached);
18 document.body.appendChild(img); 25 document.body.appendChild(img);
19 }; 26 };
20 var loadViewportImage = function() { 27 var loadViewportImage = function() {
21 var img = new Image(); 28 var img = new Image();
22 img.src = 'resources/image-checks-for-viewport-width.php'; 29 img.src = 'resources/image-checks-for-viewport-width.php';
23 img.onload = t.step_func(loadRWImage); 30 img.onload = t.step_func(loadRWImage);
24 img.onerror = t.step_func(unreached); 31 img.onerror = t.step_func(unreached);
25 document.body.appendChild(img); 32 document.body.appendChild(img);
26 }; 33 };
27 t.step(function() { 34 t.step(function() {
28 var img = new Image(); 35 var img = new Image();
29 img.src = 'resources/image-checks-for-dpr.php'; 36 img.src = 'resources/image-checks-for-dpr.php';
30 img.onload = t.step_func(loadViewportImage); 37 img.onload = t.step_func(loadViewportImage);
31 img.onerror = t.step_func(unreached); 38 img.onerror = t.step_func(unreached);
32 document.body.appendChild(img); 39 document.body.appendChild(img);
33 }); 40 });
34 </script> 41 </script>
35 </body> 42 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698