Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html

Issue 2408203007: DevTools: teach network UISourceCodes to return metadata (Closed)
Patch Set: address comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html
new file mode 100644
index 0000000000000000000000000000000000000000..995aa5800f34e70e8e3bf73686665b789946d76f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html
@@ -0,0 +1,91 @@
+<html>
+<head>
+<script src="/inspector/inspector-test.js"></script>
+<script src="/inspector/debugger-test.js"></script>
+<link rel="stylesheet">
+<script>
+
+function addScript()
+{
+ var fulfill;
+ var promise = new Promise(x => fulfill = x);
+ var script = document.createElement("script");
+ script.type = "text/javascript";
+ script.src = "resources/script.js";
+ script.onload = fulfill;
+ document.body.appendChild(script);
+ return promise;
+}
+
+function addStyleSheetAndRunTest()
+{
+ if (testRunner)
+ testRunner.waitUntilDone();
+ var link = document.head.querySelector("link");
+ link.href = "resources/style.css";
+ link.onload = runTest;
+}
+
+function test()
+{
+ InspectorTest.runTestSuite([
+ function testCachedResource(next)
+ {
+ InspectorTest.waitForScriptSource("style.css", onStyleSheet)
+
+ function onStyleSheet(uiSourceCode)
+ {
+ dumpMetadata(uiSourceCode, next);
+ }
+ },
+
+ function testDynamicResource(next)
+ {
+ InspectorTest.evaluateInPageAsync("addScript()");
+ InspectorTest.waitForScriptSource("script.js", onScript);
+
+ function onScript(uiSourceCode)
+ {
+ dumpMetadata(uiSourceCode, next);
+ }
+ },
+
+ function testInlinedSourceMapSource(next)
+ {
+ InspectorTest.waitForScriptSource("style.scss", onSourceMapSource);
+
+ function onSourceMapSource(uiSourceCode)
+ {
+ dumpMetadata(uiSourceCode, next);
+ }
+ },
+ ]);
+
+ function dumpMetadata(uiSourceCode, next)
+ {
+ uiSourceCode.requestMetadata().then(onMetadata);
+
+ function onMetadata(metadata)
+ {
+ InspectorTest.addResult("Metadata for UISourceCode: " + uiSourceCode.url());
+ if (!metadata) {
+ InspectorTest.addResult(" Metadata is EMPTY");
+ next();
+ return;
+ }
+ var contentSize = metadata.contentSize;
+ var time = metadata.modificationTime ? "<Date>" : "null";
+ InspectorTest.addResult(" content size: " + contentSize);
+ InspectorTest.addResult(" modification time: " + time);
+ next();
+ }
+ }
+}
+
+</script>
+</head>
+
+<body onload="addStyleSheetAndRunTest()">
+<p>Verify that network UISourceCode has metadata.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698