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

Unified Diff: LayoutTests/inspector-protocol/css/cssom-matching-rules-multiple.html

Issue 1211813002: DevTools: allow injecting CSS rules without breaking styles sidebar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments addressed. Created 5 years, 6 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/cssom-matching-rules-multiple.html
diff --git a/LayoutTests/inspector-protocol/css/cssom-matching-rules-multiple.html b/LayoutTests/inspector-protocol/css/cssom-matching-rules-multiple.html
new file mode 100644
index 0000000000000000000000000000000000000000..80b378b368883779552f5d0952dd1645b5253c52
--- /dev/null
+++ b/LayoutTests/inspector-protocol/css/cssom-matching-rules-multiple.html
@@ -0,0 +1,112 @@
+<html>
+<head>
+
+<style>
+#test {
+ color: red;
+}
+
+#test {
+ color: green;
+}
+
+#test {
+ color: blue;
+}
+
+#test {
+ width: 10%;
+}
+
+#test {
+ width: 20%;
+}
+
+#test {
+ width: 30%;
+}
+
+#test {
+ width: 40%;
+}
+
+#test {
+ width: 50%;
+}
+
+#test {
+ width: 60%;
+}
+</style>
+
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/css-protocol-test.js"></script>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
+<script type="text/javascript">
+
+function test()
+{
+ var documentNodeId;
+
+ InspectorTest.requestDocumentNodeId(onDocumentNodeId);
+
+ function onDocumentNodeId(nodeId)
+ {
+ documentNodeId = nodeId;
+ InspectorTest.sendCommandOrDie("CSS.enable", {}, function() {
+ InspectorTest.runTestSuite(testSuite);
+ });
+ }
+
+ var testSuite = [
+ function testModifyRule(next)
+ {
+ InspectorTest.log("--------------");
+ InspectorTest.log("Original rule:");
+ InspectorTest.loadAndDumpMatchingRules(documentNodeId, "#test", step1, true);
+
+ function step1()
+ {
+ InspectorTest.log("Mutating 3rd:");
+ InspectorTest.log("---------------");
+ InspectorTest.evaluateInPage("document.styleSheets[0].rules[3].style.setProperty('color', 'red')");
+ InspectorTest.evaluateInPage("document.styleSheets[0].rules[3].style.removeProperty('width')");
+ InspectorTest.loadAndDumpMatchingRules(documentNodeId, "#test", step2, true);
+ }
+
+ function step2()
+ {
+ InspectorTest.log("Mutating 4th:");
+ InspectorTest.log("--------------");
+ InspectorTest.evaluateInPage("document.styleSheets[0].rules[4].style.setProperty('color', 'green')");
+ InspectorTest.evaluateInPage("document.styleSheets[0].rules[4].style.removeProperty('width')");
+ InspectorTest.loadAndDumpMatchingRules(documentNodeId, "#test", step3, true);
+ }
+
+ function step3()
+ {
+ InspectorTest.log("Mutating 5th:");
+ InspectorTest.log("--------------");
+ InspectorTest.evaluateInPage("document.styleSheets[0].rules[5].style.setProperty('color', 'blue')");
+ InspectorTest.evaluateInPage("document.styleSheets[0].rules[5].style.removeProperty('width')");
+ InspectorTest.loadAndDumpMatchingRules(documentNodeId, "#test", step4, true);
+ }
+
+ function step4()
+ {
+ InspectorTest.log("Delete first 3:");
+ InspectorTest.log("---------------");
+ InspectorTest.evaluateInPage("for (var i = 0; i < 3; ++i) document.styleSheets[0].removeRule(0);");
+ InspectorTest.loadAndDumpMatchingRules(documentNodeId, "#test", next, true);
+ }
+ },
+ ];
+}
+
+</script>
+</head>
+<body onload="runTest();">
+<p>The test verifies CSS.getMatchedStylesForNode when used concurrently with multiple CSSOM modifications.</p>
+<article id="test"></article>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698