| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="inspector-test.js"></script> | 3 <script src="inspector-test.js"></script> |
| 4 <script src="console-test.js"></script> | 4 <script src="console-test.js"></script> |
| 5 <script src="network-test.js"></script> | 5 <script src="network-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 function requestHelper(method, url, callback) | 7 function requestHelper(method, url, callback) |
| 8 { | 8 { |
| 9 console.log("sending a " + method + " request to " + url); | 9 console.log("sending a " + method + " request to " + url); |
| 10 // Delay invoking callback to let didFinishLoading() a chance to fire and lo
g | 10 // Delay invoking callback to let didFinishLoading() a chance to fire and lo
g |
| 11 // console message. | 11 // console message. |
| 12 function delayCallback() | 12 function delayCallback() |
| 13 { | 13 { |
| 14 setTimeout(callback, 0); | 14 setTimeout(callback, 0); |
| 15 } | 15 } |
| 16 makeFetch(url, {method: method}, delayCallback); | 16 makeFetch(url, {method: method}).then(delayCallback); |
| 17 } | 17 } |
| 18 | 18 |
| 19 function makeRequests(callback) | 19 function makeRequests() |
| 20 { | 20 { |
| 21 var callback; |
| 22 var promise = new Promise((fulfill) => callback = fulfill); |
| 21 step1(); | 23 step1(); |
| 24 return promise; |
| 22 | 25 |
| 23 function step1() | 26 function step1() |
| 24 { | 27 { |
| 25 // Page that exists. | 28 // Page that exists. |
| 26 requestHelper("GET", "resources/xhr-exists.html", step2); | 29 requestHelper("GET", "resources/xhr-exists.html", step2); |
| 27 } | 30 } |
| 28 | 31 |
| 29 function step2() | 32 function step2() |
| 30 { | 33 { |
| 31 // Page that doesn't exist. | 34 // Page that doesn't exist. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 } | 49 } |
| 47 | 50 |
| 48 function test() | 51 function test() |
| 49 { | 52 { |
| 50 step1(); | 53 step1(); |
| 51 | 54 |
| 52 function step1() | 55 function step1() |
| 53 { | 56 { |
| 54 function callback() | 57 function callback() |
| 55 { | 58 { |
| 56 InspectorTest.invokePageFunctionAsync("makeRequests", step2); | 59 InspectorTest.callFunctionInPageAsync("makeRequests").then(step2); |
| 57 } | 60 } |
| 58 InspectorTest.NetworkAgent.setMonitoringXHREnabled(true, callback); | 61 InspectorTest.NetworkAgent.setMonitoringXHREnabled(true, callback); |
| 59 } | 62 } |
| 60 | 63 |
| 61 function step2() | 64 function step2() |
| 62 { | 65 { |
| 63 function callback() | 66 function callback() |
| 64 { | 67 { |
| 65 InspectorTest.invokePageFunctionAsync("makeRequests", step3); | 68 InspectorTest.callFunctionInPageAsync("makeRequests").then(step3); |
| 66 } | 69 } |
| 67 InspectorTest.NetworkAgent.setMonitoringXHREnabled(false, callback); | 70 InspectorTest.NetworkAgent.setMonitoringXHREnabled(false, callback); |
| 68 } | 71 } |
| 69 | 72 |
| 70 function step3() | 73 function step3() |
| 71 { | 74 { |
| 72 function finish() | 75 function finish() |
| 73 { | 76 { |
| 74 InspectorTest.dumpConsoleMessages(); | 77 InspectorTest.dumpConsoleMessages(); |
| 75 InspectorTest.completeTest(); | 78 InspectorTest.completeTest(); |
| 76 } | 79 } |
| 77 InspectorTest.deprecatedRunAfterPendingDispatches(finish); | 80 InspectorTest.deprecatedRunAfterPendingDispatches(finish); |
| 78 } | 81 } |
| 79 } | 82 } |
| 80 //# sourceURL=console-fetch-logging.html | 83 //# sourceURL=console-fetch-logging.html |
| 81 </script> | 84 </script> |
| 82 </head> | 85 </head> |
| 83 | 86 |
| 84 <body onload="runTest()"> | 87 <body onload="runTest()"> |
| 85 <p> | 88 <p> |
| 86 Tests that fetch logging works when XMLHttpRequest Logging is Enabled and doesn'
t show logs when it is Disabled. | 89 Tests that fetch logging works when XMLHttpRequest Logging is Enabled and doesn'
t show logs when it is Disabled. |
| 87 </p> | 90 </p> |
| 88 | 91 |
| 89 </body> | 92 </body> |
| 90 </html> | 93 </html> |
| OLD | NEW |