| Index: LayoutTests/inspector-protocol/css/css-create-stylesheet-and-add-rule.html
|
| diff --git a/LayoutTests/inspector-protocol/css/css-create-stylesheet-and-add-rule.html b/LayoutTests/inspector-protocol/css/css-create-stylesheet-and-add-rule.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e30ee74b150ac30fd900450e20ca93a100338243
|
| --- /dev/null
|
| +++ b/LayoutTests/inspector-protocol/css/css-create-stylesheet-and-add-rule.html
|
| @@ -0,0 +1,78 @@
|
| +<html>
|
| +<head>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script type="text/javascript" src="css-protocol-test.js"></script>
|
| +<link rel="stylesheet" type="text/css" href="resources/stylesheet.css"></link>
|
| +<script type="text/javascript">
|
| +function test()
|
| +{
|
| + var frameId;
|
| + var styleSheetHeader;
|
| +
|
| + setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000);
|
| +
|
| + InspectorTest.requestMainFrameId(step2);
|
| +
|
| + function step2(mainFrameId)
|
| + {
|
| + frameId = mainFrameId;
|
| + InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
|
| + InspectorTest.sendCommandOrDie("CSS.enable", {}, function() {})
|
| + }
|
| +
|
| + function styleSheetAdded(response)
|
| + {
|
| + var header = response.params.header;
|
| + var urlString = header.sourceURL ? " (" + InspectorTest.displayName(header.sourceURL) + ")" : "";
|
| + InspectorTest.log("Style sheet added: " + header.origin + urlString);
|
| + if (styleSheetHeader)
|
| + return;
|
| +
|
| + styleSheetHeader = header;
|
| + InspectorTest.loadAndDumpMatchingRules("#inspected", step3);
|
| + }
|
| +
|
| + function step3()
|
| + {
|
| + InspectorTest.log("Adding a rule to the existing stylesheet.");
|
| + InspectorTest.sendCommandOrDie("CSS.addRule", { styleSheetId: styleSheetHeader.styleSheetId, selector: "#inspected" }, step4);
|
| + }
|
| +
|
| + function step4()
|
| + {
|
| + InspectorTest.loadAndDumpMatchingRules("#inspected", step5);
|
| + }
|
| +
|
| + function step5()
|
| + {
|
| + InspectorTest.log("Creating inspector stylesheet.");
|
| + InspectorTest.sendCommandOrDie("CSS.createStyleSheet", { frameId: frameId }, step6);
|
| + }
|
| +
|
| + function step6(result)
|
| + {
|
| + InspectorTest.log("Adding a rule to the inspector stylesheet.");
|
| + InspectorTest.sendCommandOrDie("CSS.addRule", { styleSheetId: result.styleSheetId, selector: "#inspected" }, step7);
|
| + }
|
| +
|
| + function step7()
|
| + {
|
| + InspectorTest.loadAndDumpMatchingRules("#inspected", step8);
|
| + }
|
| +
|
| + function step8()
|
| + {
|
| + InspectorTest.completeTest();
|
| + }
|
| +};
|
| +
|
| +window.addEventListener("DOMContentLoaded", function () {
|
| + runTest();
|
| +}, false);
|
| +
|
| +</script>
|
| +</head>
|
| +<body>
|
| +<div id="inspected">Inspected contents</div>
|
| +</body>
|
| +</html>
|
|
|