OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../inspector-test.js"></script> |
| 4 <script> |
| 5 function sendSyncScriptRequest() |
| 6 { |
| 7 var iframe = document.createElement("iframe"); |
| 8 document.body.appendChild(iframe); |
| 9 iframe.contentDocument.write('<html><body><script src="http://localhost:8000
/inspector/network/resources/empty-script.js?sync"></s' + 'cript>;</body></html>
'); |
| 10 } |
| 11 |
| 12 function sendAsyncScriptRequest() |
| 13 { |
| 14 var iframe = document.createElement("iframe"); |
| 15 document.body.appendChild(iframe); |
| 16 iframe.contentDocument.write('<html><body><script src="http://localhost:8000
/inspector/network/resources/empty-script.js?async" async></s' + 'cript>;</body>
</html>'); |
| 17 } |
| 18 |
| 19 function sendXHRSync() |
| 20 { |
| 21 var xhr = new XMLHttpRequest(); |
| 22 xhr.open("GET", "resources/empty.html?xhr-sync", false); |
| 23 xhr.send(); |
| 24 } |
| 25 |
| 26 function sendXHRAsync() |
| 27 { |
| 28 var xhr = new XMLHttpRequest(); |
| 29 xhr.open("GET", "resources/empty.html?xhr-async"); |
| 30 xhr.send(); |
| 31 } |
| 32 |
| 33 function sendImageRequest() |
| 34 { |
| 35 var img = document.createElement("img"); |
| 36 img.src = "resources/abe.png"; |
| 37 document.body.appendChild(img); |
| 38 } |
| 39 |
| 40 function sendStyleRequest() |
| 41 { |
| 42 var link = document.createElement("link"); |
| 43 link.rel = "stylesheet"; |
| 44 link.href = "resources/style.css"; |
| 45 document.head.appendChild(link); |
| 46 } |
| 47 |
| 48 function createIFrame() |
| 49 { |
| 50 var iframe = document.createElement("iframe"); |
| 51 iframe.src = "resources/empty.html?iframe"; |
| 52 document.head.appendChild(iframe); |
| 53 } |
| 54 |
| 55 function test() |
| 56 { |
| 57 var actions = [ |
| 58 "sendSyncScriptRequest", |
| 59 "sendAsyncScriptRequest", |
| 60 "sendXHRSync", |
| 61 "sendXHRAsync", |
| 62 "sendImageRequest", |
| 63 "sendStyleRequest", |
| 64 "createIFrame" |
| 65 ]; |
| 66 InspectorTest.networkManager.addEventListener(WebInspector.NetworkManager.Ev
entTypes.RequestStarted, onRequestStarted); |
| 67 |
| 68 var nextAction = 0; |
| 69 performNextRequest(); |
| 70 |
| 71 function performNextRequest() |
| 72 { |
| 73 if (nextAction >= actions.length) { |
| 74 InspectorTest.networkManager.removeEventListener(WebInspector.Networ
kManager.EventTypes.RequestStarted, onRequestStarted); |
| 75 InspectorTest.completeTest(); |
| 76 return; |
| 77 } |
| 78 InspectorTest.evaluateInPage(actions[nextAction++] + "()"); |
| 79 } |
| 80 function onRequestStarted(event) |
| 81 { |
| 82 var request = event.data; |
| 83 InspectorTest.addResult("Request: " + request.name() + " priority: " + r
equest.initialPriority()); |
| 84 performNextRequest(); |
| 85 } |
| 86 } |
| 87 </script> |
| 88 </head> |
| 89 <body onload="runTest()"> |
| 90 <p>Tests resource priorities.</p> |
| 91 </body> |
| 92 </html> |
OLD | NEW |