| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="/inspector/inspector-test.js"></script> |
| 4 <script src="/inspector/debugger-test.js"></script> |
| 5 <link rel="stylesheet"> |
| 6 <script> |
| 7 |
| 8 function addScript() |
| 9 { |
| 10 var fulfill; |
| 11 var promise = new Promise(x => fulfill = x); |
| 12 var script = document.createElement("script"); |
| 13 script.type = "text/javascript"; |
| 14 script.src = "resources/script.js"; |
| 15 script.onload = fulfill; |
| 16 document.body.appendChild(script); |
| 17 return promise; |
| 18 } |
| 19 |
| 20 function addStyleSheetAndRunTest() |
| 21 { |
| 22 if (testRunner) |
| 23 testRunner.waitUntilDone(); |
| 24 var link = document.head.querySelector("link"); |
| 25 link.href = "resources/style.css"; |
| 26 link.onload = runTest; |
| 27 } |
| 28 |
| 29 function test() |
| 30 { |
| 31 InspectorTest.runTestSuite([ |
| 32 function testCachedResource(next) |
| 33 { |
| 34 InspectorTest.waitForScriptSource("style.css", onStyleSheet) |
| 35 |
| 36 function onStyleSheet(uiSourceCode) |
| 37 { |
| 38 dumpMetadata(uiSourceCode, next); |
| 39 } |
| 40 }, |
| 41 |
| 42 function testDynamicResource(next) |
| 43 { |
| 44 InspectorTest.evaluateInPageAsync("addScript()"); |
| 45 InspectorTest.waitForScriptSource("script.js", onScript); |
| 46 |
| 47 function onScript(uiSourceCode) |
| 48 { |
| 49 dumpMetadata(uiSourceCode, next); |
| 50 } |
| 51 }, |
| 52 |
| 53 function testInlinedSourceMapSource(next) |
| 54 { |
| 55 InspectorTest.waitForScriptSource("style.scss", onSourceMapSource); |
| 56 |
| 57 function onSourceMapSource(uiSourceCode) |
| 58 { |
| 59 dumpMetadata(uiSourceCode, next); |
| 60 } |
| 61 }, |
| 62 ]); |
| 63 |
| 64 function dumpMetadata(uiSourceCode, next) |
| 65 { |
| 66 uiSourceCode.requestMetadata().then(onMetadata); |
| 67 |
| 68 function onMetadata(metadata) |
| 69 { |
| 70 InspectorTest.addResult("Metadata for UISourceCode: " + uiSourceCode
.url()); |
| 71 if (!metadata) { |
| 72 InspectorTest.addResult(" Metadata is EMPTY"); |
| 73 next(); |
| 74 return; |
| 75 } |
| 76 var contentSize = metadata.contentSize; |
| 77 var time = metadata.modificationTime ? "<Date>" : "null"; |
| 78 InspectorTest.addResult(" content size: " + contentSize); |
| 79 InspectorTest.addResult(" modification time: " + time); |
| 80 next(); |
| 81 } |
| 82 } |
| 83 } |
| 84 |
| 85 </script> |
| 86 </head> |
| 87 |
| 88 <body onload="addStyleSheetAndRunTest()"> |
| 89 <p>Verify that network UISourceCode has metadata.</p> |
| 90 </body> |
| 91 </html> |
| OLD | NEW |