4 <script src="../inspector-test.js"></script>
5 <script src="../network-test.js"></script>
12 InspectorTest.makeSimpleXHR("GET", "resources/binary.data", false, step2);
17 var writer = new WebInspector.HARWriter();
18 var stream = new InspectorTest.StringOutputStream(onSaved);
19 writer.write(stream, InspectorTest.networkRequests(), new WebInspector.Progress());
22 function dumpContent(content)
25 InspectorTest.addResult(" NOT FOUND");
28 var propertyNames = Object.keys(content);
30 for (var i = 0; i < propertyNames.length; ++i) {
31 var prop = propertyNames[i];
32 InspectorTest.addResult(" " + prop + ": " + JSON.stringify(content[prop]));
36 function onSaved(data)
38 var har = JSON.parse(data);
40 InspectorTest.addResult("initiator.css:");
41 dumpContent(findEntry(har, /\/initiator\.css$/).response.content);
43 InspectorTest.addResult("");
45 InspectorTest.addResult("binary.data:");
46 dumpContent(findEntry(har, /\/binary\.data$/).response.content);
48 InspectorTest.completeTest();
51 function findEntry(har, regexp)
53 var entries = har.log.entries;
54 for (var i = 0; i < entries.length; ++i) {
55 var entry = entries[i];
56 if (regexp.test(entry.request.url))
59 InspectorTest.addResult("FAIL: can't find resource for " + regexp);
63 InspectorTest.makeSimpleXHR("GET", "resources/initiator.css", false, step1);
70 <body onload="runTest()">
72 Tests conversion of Inspector's resource representation into HAR format.