3 <link rel=
"stylesheet" href=
"resources/audits-style1.css" type=
"text/css">
7 src: url(../../resources/Ahem.ttf);
10 p { font-family: 'test'; }
13 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
14 <script src=
"../../http/tests/inspector/extensions-test.js"></script>
15 <script src=
"../../http/tests/inspector/extensions-network-test.js"></script>
16 <script type=
"text/javascript">
18 function extension_testGetHAR(nextTest
)
20 function compareEntries(a
, b
)
22 return a
.request
.url
.toLowerCase().localeCompare(b
.request
.url
.toLowerCase());
25 function onHAR(result
)
27 result
.entries
.sort(compareEntries
);
29 for (var i
= 0; i
< result
.entries
.length
; ++i
)
30 output("resource: " + result
.entries
[i
].request
.url
.replace(/.*((\/[^/]*){3}$)/,"...$1"));
32 extension_doXHR(function() {
33 webInspector
.network
.getHAR(callbackAndNextTest(onHAR
, nextTest
));
39 var xhr
= new XMLHttpRequest();
40 xhr
.open("GET", "", false);
44 function extension_doXHR(callback
)
46 webInspector
.inspectedWindow
.eval("doXHR()", callback
);
49 function extension_testRequestNotification(nextTest
)
51 function onRequestFinished(request
)
53 output("Request finished: " + request
.request
.url
.replace(/.*((\/[^/]*){3}$)/,"...$1"));
56 webInspector
.network
.onRequestFinished
.addListener(callbackAndNextTest(onRequestFinished
, nextTest
));
60 function extension_onRequestBody(content
, encoding
)
62 dumpObject(Array
.prototype.slice
.call(arguments
));
65 function extension_testGetRequestContent(nextTest
)
67 extension_getRequestByUrl([/audits-style1.css$/], function(request
) {
68 request
.getContent(callbackAndNextTest(extension_onRequestBody
, nextTest
));
72 function extension_testGetResourceContentEncoded(nextTest
)
74 extension_getRequestByUrl([/abe.png$/ ], function(request
) {
75 request
.getContent(callbackAndNextTest(extension_onRequestBody
, nextTest
));
81 InspectorTest
.reloadPage(InspectorTest
.runExtensionTests
);
86 <body onload=
"runTest()">
87 <p>Tests WebInspector extension API
</p>
88 <img src=
"resources/abe.png">
89 <img src=
"resources/missing-image.png">