3 <link rel=
"stylesheet" href=
"resources/set-style-text.css"/>
4 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
5 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/css-protocol-test.js"></script>
6 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
7 <script type=
"text/javascript">
13 var verifyProtocolError
;
16 InspectorTest
.sendCommandOrDie("DOM.enable", {});
17 InspectorTest
.sendCommandOrDie("CSS.enable", {}, cssWasEnabled
);
19 function cssWasEnabled()
21 InspectorTest
.sendCommandOrDie("DOM.getDocument", {}, onGotDocument
);
24 function onGotDocument(result
)
26 documentNodeId
= result
.root
.nodeId
;
27 InspectorTest
.sendCommandOrDie("DOM.querySelector", { nodeId
: documentNodeId
, selector
: "#inliner" }, onGotNode
);
30 function onGotNode(node
)
32 InspectorTest
.sendCommandOrDie("CSS.getInlineStylesForNode", { nodeId
: node
.nodeId
}, onGotInlineStyles
);
35 function onGotInlineStyles(result
)
37 styleSheetId
= result
.inlineStyle
.styleSheetId
;
38 setStyleText
= InspectorTest
.setStyleText
.bind(InspectorTest
, styleSheetId
, false);
39 verifyProtocolError
= InspectorTest
.setStyleText
.bind(InspectorTest
, styleSheetId
, true);
40 dumpStyleSheet
= InspectorTest
.dumpStyleSheetText
.bind(null, styleSheetId
);
41 InspectorTest
.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId
: styleSheetId
}, onInitialStyleSheetText
);
44 function dumpAndNext(next
)
48 InspectorTest
.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId
: styleSheetId
}, onReceiveStyleSheetText
);
50 function onReceiveStyleSheetText(result
)
52 InspectorTest
.log("Stylesheet text: " + result
.text
);
53 InspectorTest
.domUndo(next
);
58 function onInitialStyleSheetText(result
)
60 InspectorTest
.log("==== Initial style sheet text ====");
61 InspectorTest
.log(result
.text
);
62 InspectorTest
.runTestSuite(testSuite
);
66 function testBasicSetStyle(next
)
69 styleSheetId
: styleSheetId
,
70 range
: { startLine
: 0, startColumn
: 0, endLine
: 0, endColumn
: 11 },
71 text
: "content: 'EDITED'",
72 }, dumpAndNext(next
));
75 function testSetStylePoorContent(next
)
78 styleSheetId
: styleSheetId
,
79 range
: { startLine
: 0, startColumn
: 0, endLine
: 0, endColumn
: 11 },
81 }, dumpAndNext(next
));
84 function testDeleteStyleBody(next
)
87 styleSheetId
: styleSheetId
,
88 range
: { startLine
: 0, startColumn
: 0, endLine
: 0, endColumn
: 11 },
90 }, dumpAndNext(next
));
93 function testSetStyleOpenComment(next
)
96 styleSheetId
: styleSheetId
,
97 range
: { startLine
: 0, startColumn
: 0, endLine
: 0, endColumn
: 11 },
99 }, dumpAndNext(next
));
106 <body onload=
"runTest();">
107 <p>The test verifies functionality of protocol method CSS.setStyleText for inline elements.
</p>
108 <div id=
"inliner" style=
"color: red;">