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

Unified Diff: LayoutTests/inspector-protocol/css/css-create-stylesheet-and-add-rule.html

Issue 177963004: DevTools: Split creating inspector stylesheet and adding a new rule into stylesheet in protocol. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comments addressed Created 6 years, 10 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: 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>

Powered by Google App Engine
This is Rietveld 408576698