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

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

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

Powered by Google App Engine
This is Rietveld 408576698