| <!doctype html> |
| <html> |
| <head> |
| <script src="inspector-test.js"></script> |
| <script src="resources-test.js"></script> |
| |
| <script> |
| |
| function doXHR() |
| { |
| var xhr = new XMLHttpRequest(); |
| xhr.open("POST", "resources/post-target.cgi", false); |
| xhr.setRequestHeader("Content-Type", "text/xml"); |
| xhr.send("<xml></xml>"); |
| } |
| |
| var test = function() |
| { |
| InspectorTest.reloadPage(step1); |
| |
| function step1() |
| { |
| InspectorTest.evaluateInPage("doXHR()", step2); |
| } |
| |
| function step2() |
| { |
| function findRequestByURL(url) |
| { |
| var requests = WebInspector.networkLog.requests; |
| for (var i = 0; i < requests.length; ++i) { |
| if (url.test(requests[i].url)) |
| return requests[i]; |
| } |
| } |
| |
| function addCookieHeadersToRequest(request) |
| { |
| request.requestHeaders = [ |
| { name: "Cookie", value: "a=b; $Path=/path; $Domain=example.com; a1=b1\nc1=d1" } |
| ]; |
| |
| request.responseHeaders = [ |
| { name: "Set-Cookie", value: "x=y; Path=/path; Domain=example.com; Discard; httpOnly; Secure; Version=1\nx1=y1\nz2=y2" } |
| ]; |
| } |
| |
| addCookieHeadersToRequest(findRequestByURL(/inspector-test\.js$/)); |
| var log = (new WebInspector.HARLog(WebInspector.networkLog.requests)).build(); |
| // Filter out favicon.ico requests that only appear on certain platforms. |
| log.entries = log.entries.filter(function(entry) { |
| return !/favicon\.ico$/.test(entry.request.url); |
| }); |
| log.entries.sort(InspectorTest.requestURLComparer); |
| InspectorTest.addObject(log, InspectorTest.HARPropertyFormattersWithSize); |
| var pageTimings = log.pages[0].pageTimings; |
| InspectorTest.completeTest(); |
| } |
| } |
| |
| </script> |
| |
| |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| Tests conversion of Inspector's resource representation into HAR format. |
| </p> |
| |
| </body> |
| </html> |