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

Unified Diff: LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText.html

Issue 132803013: DevTools: [CSS] setStyleSheetText to work with inline stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address @apavlov comments 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
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText.html
diff --git a/LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText.html b/LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText.html
new file mode 100644
index 0000000000000000000000000000000000000000..fa6ba1d999e0cdcbdd53669a8b4c673064da66bc
--- /dev/null
+++ b/LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText.html
@@ -0,0 +1,78 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script type="text/javascript">
+
+function test()
+{
+ var inlineStyleSheetId;
+ function sendCommand(command, properties, callback) {
+ InspectorTest.sendCommand(command, properties || {}, commandCallback);
+ function commandCallback(msg)
+ {
+ if (msg.error) {
+ InspectorTest.log(msg.error.message);
+ InspectorTest.completeTest();
+ return;
+ }
+ callback(msg.result);
+ }
+ }
+
+ InspectorTest.sendCommand("CSS.enable", {}, cssWasEnabled);
+
+ function cssWasEnabled()
+ {
+ sendCommand("DOM.getDocument", {}, onGotDocument);
+ }
+
+ function onGotDocument(result)
+ {
+ var root = result.root;
+ sendCommand("DOM.querySelector", {
+ nodeId: root.nodeId,
+ selector: "#inliner"
+ }, onGotNode);
+ }
+
+ function onGotNode(node)
+ {
+ sendCommand("CSS.getInlineStylesForNode", { nodeId: node.nodeId }, onGotInlineStyles);
+ }
+
+ function onGotInlineStyles(result)
+ {
+ inlineStyleSheetId = result.inlineStyle.styleId.styleSheetId;
+ sendCommand("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId }, onReceiveStyleSheetText);
+ }
+
+ function onReceiveStyleSheetText(result)
+ {
+ InspectorTest.log(result.text);
+ sendCommand("CSS.setStyleSheetText", {
+ styleSheetId: inlineStyleSheetId,
+ text: "border: 1px solid black;"
+ }, onSetStyleSheetBody);
+ }
+
+ function onSetStyleSheetBody(result)
+ {
+ sendCommand("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId }, onCheckStyleSheetBody);
+ }
+
+ function onCheckStyleSheetBody(result)
+ {
+ InspectorTest.log(result.text);
+ InspectorTest.completeTest();
+ }
+};
+
+</script>
+</head>
+<body onload="runTest()">
+
+<div id="inliner" style="color: red;">
+</div>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css/css-set-inline-styleSheetText-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698