| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script type="text/javascript" src="../http/tests/inspector-protocol/resources/p
rotocol-test.js"></script> | 4 <script type="text/javascript" src="../http/tests/inspector-protocol/resources/p
rotocol-test.js"></script> |
| 5 <script> | 5 <script type="text/javascript"> |
| 6 function pageLoaded() | 6 function pageLoaded() |
| 7 { | 7 { |
| 8 var template = document.querySelector('#tmpl'); | 8 var template = document.querySelector("#tmpl"); |
| 9 var root = document.querySelector('#host').webkitCreateShadowRoot(); | 9 var root = document.querySelector("#host").webkitCreateShadowRoot(); |
| 10 root.appendChild(template.content.cloneNode(true)); | 10 root.appendChild(template.content.cloneNode(true)); |
| 11 runTest(); | 11 runTest(); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function test() | 14 function test() |
| 15 { | 15 { |
| 16 InspectorTest.sendCommand("CSS.enable", {}, step1); | 16 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; |
| 17 | 17 InspectorTest.sendCommand("CSS.enable", {}, null); |
| 18 function step1() | 18 |
| 19 function styleSheetAdded(msg) |
| 19 { | 20 { |
| 20 InspectorTest.sendCommand("CSS.getAllStyleSheets", {}, step2); | 21 var styleSheetHeader = msg.params.header; |
| 22 InspectorTest.sendCommand("CSS.getStyleSheetText", {"styleSheetId": styl
eSheetHeader.styleSheetId}, onStyleSheetText); |
| 21 } | 23 } |
| 22 | 24 |
| 23 function step2(payload) | 25 function onStyleSheetText(payload) |
| 24 { | |
| 25 var headers = payload.result.headers | |
| 26 InspectorTest.log("Loaded style sheets count: " + headers.length); | |
| 27 var styleSheetHeader = headers[0]; | |
| 28 InspectorTest.sendCommand("CSS.getStyleSheetText", {"styleSheetId": styl
eSheetHeader.styleSheetId}, step3); | |
| 29 } | |
| 30 | |
| 31 function step3(payload) | |
| 32 { | 26 { |
| 33 InspectorTest.log("Loaded style sheet text: " + payload.result.text); | 27 InspectorTest.log("Loaded style sheet text: " + payload.result.text); |
| 34 InspectorTest.completeTest(); | 28 InspectorTest.completeTest(); |
| 35 } | 29 } |
| 36 } | 30 } |
| 37 </script> | 31 </script> |
| 38 </head> | 32 </head> |
| 39 <body onload="pageLoaded()"> | 33 <body onload="pageLoaded()"> |
| 40 <p>This test checks that style sheets hosted inside shadow roots are reported in
CSS.getAllStyleSheets protocol method.</p> | 34 <p>This test checks that style sheets hosted inside shadow roots are reported in
CSS.getAllStyleSheets protocol method.</p> |
| 41 <div id="host"></div> | 35 <div id="host"></div> |
| 42 <template id="tmpl"> | 36 <template id="tmpl"> |
| 43 <style> .red { color: red; } </style> | 37 <style> .red { color: red; } </style> |
| 44 <div id="inner" class="red">hi!</div> | 38 <div id="inner" class="red">hi!</div> |
| 45 </template> | 39 </template> |
| 46 </body> | 40 </body> |
| 47 </html> | 41 </html> |
| OLD | NEW |