Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-4 / stylesheet-source-url-comment.html
blob8ab1c2cfa7e170d9ce52572d1f60810899552c84
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <style>
6 body {
7 color: green;
10 /*# sourceURL=inlineStyleSheet.css */
11 </style>
12 <script>
13 function addInlineStyleSheet()
15 var styleElement = document.createElement("style");
16 styleElement.textContent = "body { color: black; }\n/*# sourceURL=css/addedInlineStylesheet.css */";
17 document.head.appendChild(styleElement);
20 function addInlineStyleSheetDeprecated()
22 var styleElement = document.createElement("style");
23 styleElement.textContent = "body { color: black; }\n/*@ sourceURL=css/addedInlineStylesheetDeprecated.css */";
24 document.head.appendChild(styleElement);
27 function addInlineStyleSheetNonRelative()
29 var styleElement = document.createElement("style");
30 styleElement.textContent = "body { color: red; }\n/*# sourceURL=/css/nonRelativeInlineStylesheet.css */";
31 document.head.appendChild(styleElement);
34 function test()
36 function forEachHeaderMatchingURL(url, handler)
38 var headers = InspectorTest.cssModel.styleSheetHeaders();
39 for (var i = 0; i < headers.length; ++i) {
40 if (headers[i].sourceURL.indexOf(url) !== -1)
41 handler(headers[i]);
45 function checkHeaderHasSourceURL(header)
47 InspectorTest.assertTrue(header.hasSourceURL);
50 InspectorTest.runTestSuite([
51 function testSourceURLCommentInInlineScript(next)
53 InspectorTest.showScriptSource("stylesheet-source-url-comment.html", didShowSource);
55 function didShowSource(sourceFrame)
57 function checkHeaderDoesNotHaveSourceURL(header)
59 InspectorTest.assertTrue(!header.hasSourceURL, "hasSourceURL flag is set for inline stylesheet");
62 forEachHeaderMatchingURL("source-url-comment.html", checkHeaderDoesNotHaveSourceURL);
63 next();
67 function testSourceURLComment(next)
69 InspectorTest.showScriptSource("css/addedInlineStylesheet.css", didShowSource);
70 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheet, 0)");
72 function didShowSource(sourceFrame)
74 InspectorTest.addResult(sourceFrame.textEditor.text());
75 forEachHeaderMatchingURL("addedInlineStylesheet", checkHeaderHasSourceURL);
76 next();
80 function testDeprecatedSourceURLComment(next)
82 InspectorTest.showScriptSource("css/addedInlineStylesheetDeprecated.css", didShowSource);
83 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetDeprecated, 0)");
85 function didShowSource(sourceFrame)
87 InspectorTest.addResult(sourceFrame.textEditor.text());
88 forEachHeaderMatchingURL("addedInlineStylesheetDeprecated", checkHeaderHasSourceURL);
89 next();
93 function testNonRelativeURL(next)
95 InspectorTest.showScriptSource("/css/nonRelativeInlineStylesheet.css", didShowSource);
96 InspectorTest.evaluateInPage("setTimeout(addInlineStyleSheetNonRelative, 0)");
98 function didShowSource(sourceFrame)
100 InspectorTest.addResult(sourceFrame.textEditor.text());
101 forEachHeaderMatchingURL("nonRelativeInlineStyleSheet.css", checkHeaderHasSourceURL);
102 next();
108 </script>
110 </head>
112 <body onload="runTest()">
113 <p>Tests that stylesheets with sourceURL comment are shown in the Sources panel.</p>
114 </body>
115 </html>