| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script> | |
| 4 function CallCommand(cmd) | |
| 5 { | |
| 6 try { | |
| 7 var req = new XMLHttpRequest; | |
| 8 req.open("GET", "/resources/network-simulator.php?command=" + cmd, false); | |
| 9 req.send(null); | |
| 10 return req.responseText; | |
| 11 } catch (ex) { | |
| 12 return ""; | |
| 13 } | |
| 14 } | |
| 15 | |
| 16 function startTest() | |
| 17 { | |
| 18 if (window.testRunner) { | |
| 19 testRunner.dumpAsText(); | |
| 20 testRunner.waitUntilDone(); | |
| 21 } | |
| 22 } | |
| 23 | |
| 24 function endTest() | |
| 25 { | |
| 26 getResourceLog(); | |
| 27 CallCommand("clear-resource-request-log"); | |
| 28 | |
| 29 if (window.testRunner) | |
| 30 testRunner.notifyDone(); | |
| 31 } | |
| 32 | |
| 33 function getResourceLog() | |
| 34 { | |
| 35 var log = CallCommand("get-resource-request-log"); | |
| 36 var logLines = log.split('\n'); | |
| 37 logLines.sort(); | |
| 38 document.getElementById('result').innerText = logLines.join('\n'); | |
| 39 } | |
| 40 | |
| 41 CallCommand("start-resource-request-log"); | |
| 42 window.addEventListener('load', startTest, false); | |
| 43 </script> | |
| 44 | |
| 45 <!-- link rel=subresource is very similar to link rel=prefetch, however it is | |
| 46 expected to have a higher network priority. This test should confirm tha
t the | |
| 47 priorities of the two types of prefetch are being observed --> | |
| 48 | |
| 49 <script> | |
| 50 var linkLoadCount = 5; | |
| 51 | |
| 52 function decrementLinkLoadCount() | |
| 53 { | |
| 54 linkLoadCount--; | |
| 55 if (linkLoadCount == 0) { | |
| 56 endTest(); | |
| 57 } | |
| 58 } | |
| 59 </script> | |
| 60 <link rel=prefetch onload="decrementLinkLoadCount()" href="/resources/network-
simulator.php?command=log-resource-request&path=1st.jpg"> | |
| 61 <link rel=subresource onload="decrementLinkLoadCount()" href="/resources/netwo
rk-simulator.php?command=log-resource-request&path=2nd.jpg"> | |
| 62 <link rel=prefetch onload="decrementLinkLoadCount()" href="/resources/network-
simulator.php?command=log-resource-request&path=3rd.jpg"> | |
| 63 <link rel=prefetch onload="decrementLinkLoadCount()" href="/resources/network-
simulator.php?command=log-resource-request&path=4th.jpg"> | |
| 64 <link rel=subresource onload="decrementLinkLoadCount()" href="/resources/netwo
rk-simulator.php?command=log-resource-request&path=5th.jpg"> | |
| 65 </head> | |
| 66 <body> | |
| 67 | |
| 68 <div class="box bordered"></div> | |
| 69 | |
| 70 <h2>Resource requests:</h2> | |
| 71 <pre id="result">Request log goes here in DRT</pre> | |
| 72 </body> | |
| 73 </html> | |
| OLD | NEW |