Index: LayoutTests/inspector-protocol/css/css-set-property-text-inline.html |
diff --git a/LayoutTests/inspector-protocol/css/css-set-property-text-inline.html b/LayoutTests/inspector-protocol/css/css-set-property-text-inline.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..967ca69c927c4ce7e643e71aedbe0dcabaaa3072 |
--- /dev/null |
+++ b/LayoutTests/inspector-protocol/css/css-set-property-text-inline.html |
@@ -0,0 +1,100 @@ |
+<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> |
+<script type="text/javascript"> |
+function test() |
+{ |
+ var setPropertyText; |
+ var verifyProtocolError; |
+ var dumpStyleSheet; |
+ |
+ InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled); |
+ |
+ function onCSSEnabled() |
+ { |
+ InspectorTest.requestNodeId("#reddiv", onNodeRecieved); |
+ } |
+ |
+ function onNodeRecieved(nodeId) |
+ { |
+ InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { |
+ nodeId: nodeId, |
+ }, onInlineStyleRecieved); |
+ } |
+ |
+ function onInlineStyleRecieved(result) |
+ { |
+ var styleSheetId = result.inlineStyle.styleId.styleSheetId; |
+ setPropertyText = InspectorTest.setPropertyText.bind(InspectorTest, styleSheetId, false); |
+ verifyProtocolError = InspectorTest.setPropertyText.bind(InspectorTest, styleSheetId, true); |
+ dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetId); |
+ InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText); |
+ } |
+ |
+ function onInitialStyleSheetText(result) |
+ { |
+ InspectorTest.log("==== Initial style sheet text ===="); |
+ InspectorTest.log(result.text); |
+ InspectorTest.runTestSuite(testSuite); |
+ } |
+ |
+ var testSuite = [ |
+ function testEditProperty(next) |
+ { |
+ setPropertyText({ |
+ styleIndex: 0, |
+ propertyIndex: 0, |
+ overwrite: true, |
+ text: "content: 'EDITED PROPERTY';" |
+ }, InspectorTest.undoAndNext(next)); |
+ }, |
+ |
+ function testBreakingCommentEditProperty(next) |
+ { |
+ verifyProtocolError({ |
+ styleIndex: 0, |
+ propertyIndex: 0, |
+ overwrite: true, |
+ text: "/*<--OPENED COMMENT" |
+ }, next); |
+ }, |
+ |
+ function testInsertFirstProperty(next) |
+ { |
+ setPropertyText({ |
+ styleIndex: 0, |
+ propertyIndex: 0, |
+ overwrite: false, |
+ text: "content: 'INSERTED PROPERTY';" |
+ }, InspectorTest.undoAndNext(next)); |
+ }, |
+ |
+ function testInsertMultipleProperties(next) |
+ { |
+ setPropertyText({ |
+ styleIndex: 0, |
+ propertyIndex: 0, |
+ overwrite: true, |
+ text: "content: 'INSERTED #1';content: 'INSERTED #2';" |
+ }, InspectorTest.undoAndNext(next)); |
+ }, |
+ |
+ function testInsertLastProperty(next) |
+ { |
+ setPropertyText({ |
+ styleIndex: 0, |
+ propertyIndex: 2, |
+ overwrite: false, |
+ text: "content: 'INSERTED PROPERTY';" |
+ }, InspectorTest.undoAndNext(next)); |
+ }, |
+ ]; |
+} |
+ |
+</script> |
+</head> |
+<body onload="runTest();"> |
+ <div id="reddiv" style="color: red; border: 0px;">Some red text goes here</div> |
+</body> |
+</html> |