Index: third_party/WebKit/LayoutTests/inspector-protocol/shadow-dom-rules-in-styleSheetAddedEvent.js |
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/shadow-dom-rules-in-styleSheetAddedEvent.js b/third_party/WebKit/LayoutTests/inspector-protocol/shadow-dom-rules-in-styleSheetAddedEvent.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8071e3e3e67a2aa1dcaad0adead2916ca0c55ef5 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/shadow-dom-rules-in-styleSheetAddedEvent.js |
@@ -0,0 +1,23 @@ |
+(async function(testRunner) { |
+ let {page, session, dp} = await testRunner.startHTML(` |
+ <div id='host'></div> |
+ <template id='tmpl'> |
+ <style> .red { color: red; } </style> |
+ <div id='inner' class='red'>hi!</div> |
+ </template> |
+ `, 'This test checks that style sheets hosted inside shadow roots are reported in CSS.styleSheetAdded event.'); |
+ |
+ await session.evaluate(` |
+ var template = document.querySelector('#tmpl'); |
+ var root = document.querySelector('#host').createShadowRoot(); |
+ root.appendChild(template.content.cloneNode(true)); |
+ `); |
+ |
+ dp.DOM.enable(); |
+ dp.CSS.enable(); |
+ var msg = await dp.CSS.onceStyleSheetAdded(); |
+ var styleSheetHeader = msg.params.header; |
+ var payload = await dp.CSS.getStyleSheetText({styleSheetId: styleSheetHeader.styleSheetId}); |
+ testRunner.log('Loaded style sheet text: ' + payload.result.text); |
+ testRunner.completeTest(); |
+}) |