OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/protocol-test.js"></script> |
| 4 <script type="text/javascript"> |
| 5 |
| 6 function test() |
| 7 { |
| 8 var inlineStyleSheetId; |
| 9 function sendCommand(command, properties, callback) { |
| 10 InspectorTest.sendCommand(command, properties || {}, commandCallback); |
| 11 function commandCallback(msg) |
| 12 { |
| 13 if (msg.error) { |
| 14 InspectorTest.log(msg.error.message); |
| 15 InspectorTest.completeTest(); |
| 16 return; |
| 17 } |
| 18 callback(msg.result); |
| 19 } |
| 20 } |
| 21 |
| 22 InspectorTest.sendCommand("CSS.enable", {}, cssWasEnabled); |
| 23 |
| 24 function cssWasEnabled() |
| 25 { |
| 26 sendCommand("DOM.getDocument", {}, onGotDocument); |
| 27 } |
| 28 |
| 29 function onGotDocument(result) |
| 30 { |
| 31 var root = result.root; |
| 32 sendCommand("DOM.querySelector", { |
| 33 nodeId: root.nodeId, |
| 34 selector: "#inliner" |
| 35 }, onGotNode); |
| 36 } |
| 37 |
| 38 function onGotNode(node) |
| 39 { |
| 40 sendCommand("CSS.getInlineStylesForNode", { nodeId: node.nodeId }, onGot
InlineStyles); |
| 41 } |
| 42 |
| 43 function onGotInlineStyles(result) |
| 44 { |
| 45 inlineStyleSheetId = result.inlineStyle.styleId.styleSheetId; |
| 46 sendCommand("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId
}, onReceiveStyleSheetText); |
| 47 } |
| 48 |
| 49 function onReceiveStyleSheetText(result) |
| 50 { |
| 51 InspectorTest.log(result.text); |
| 52 sendCommand("CSS.setStyleSheetText", { |
| 53 styleSheetId: inlineStyleSheetId, |
| 54 text: "border: 1px solid black;" |
| 55 }, onSetStyleSheetBody); |
| 56 } |
| 57 |
| 58 function onSetStyleSheetBody(result) |
| 59 { |
| 60 sendCommand("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId
}, onCheckStyleSheetBody); |
| 61 } |
| 62 |
| 63 function onCheckStyleSheetBody(result) |
| 64 { |
| 65 InspectorTest.log(result.text); |
| 66 InspectorTest.completeTest(); |
| 67 } |
| 68 }; |
| 69 |
| 70 </script> |
| 71 </head> |
| 72 <body onload="runTest()"> |
| 73 |
| 74 <div id="inliner" style="color: red;"> |
| 75 </div> |
| 76 |
| 77 </body> |
| 78 </html> |
OLD | NEW |