| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
| 5 | 5 |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var inlineStyleSheetId; | 8 var inlineStyleSheetId; |
| 9 | 9 |
| 10 InspectorTest.sendCommand("CSS.enable", {}, cssWasEnabled); | 10 InspectorTest.sendCommand("CSS.enable", {}, cssWasEnabled); |
| 11 | 11 |
| 12 async function cssWasEnabled() | 12 function cssWasEnabled() |
| 13 { | 13 { |
| 14 var result = await InspectorTest.sendCommandOrDie("DOM.getDocument", {})
; | 14 InspectorTest.sendCommandOrDie("DOM.getDocument", {}, onGotDocument); |
| 15 } |
| 16 |
| 17 function onGotDocument(result) |
| 18 { |
| 15 var root = result.root; | 19 var root = result.root; |
| 16 var node = await InspectorTest.sendCommandOrDie("DOM.querySelector", { | 20 InspectorTest.sendCommandOrDie("DOM.querySelector", { |
| 17 nodeId: root.nodeId, | 21 nodeId: root.nodeId, |
| 18 selector: "#inliner" | 22 selector: "#inliner" |
| 19 }); | 23 }, onGotNode); |
| 24 } |
| 20 | 25 |
| 21 await InspectorTest.sendCommandOrDie("CSS.enable", { }); | 26 function onGotNode(node) |
| 27 { |
| 28 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { nodeId: n
ode.nodeId }, onGotInlineStyles); |
| 29 } |
| 22 | 30 |
| 23 result = await InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNod
e", { nodeId: node.nodeId }); | 31 function onGotInlineStyles(result) |
| 32 { |
| 24 inlineStyleSheetId = result.inlineStyle.styleSheetId; | 33 inlineStyleSheetId = result.inlineStyle.styleSheetId; |
| 34 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
inlineStyleSheetId }, onReceiveStyleSheetText); |
| 35 } |
| 25 | 36 |
| 26 result = await InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", {
styleSheetId: inlineStyleSheetId }); | 37 function onReceiveStyleSheetText(result) |
| 38 { |
| 27 InspectorTest.log(result.text); | 39 InspectorTest.log(result.text); |
| 28 | 40 InspectorTest.sendCommandOrDie("CSS.setStyleSheetText", { |
| 29 result = await InspectorTest.sendCommandOrDie("CSS.setStyleSheetText", { | |
| 30 styleSheetId: inlineStyleSheetId, | 41 styleSheetId: inlineStyleSheetId, |
| 31 text: "border: 1px solid black;" | 42 text: "border: 1px solid black;" |
| 32 }); | 43 }, onSetStyleSheetBody); |
| 44 } |
| 33 | 45 |
| 34 result = await InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", {
styleSheetId: inlineStyleSheetId }); | 46 function onSetStyleSheetBody(result) |
| 47 { |
| 48 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
inlineStyleSheetId }, onCheckStyleSheetBody); |
| 49 } |
| 50 |
| 51 function onCheckStyleSheetBody(result) |
| 52 { |
| 35 InspectorTest.log(result.text); | 53 InspectorTest.log(result.text); |
| 36 InspectorTest.completeTest(); | 54 InspectorTest.completeTest(); |
| 37 } | 55 } |
| 38 }; | 56 }; |
| 39 | 57 |
| 40 </script> | 58 </script> |
| 41 </head> | 59 </head> |
| 42 <body onload="runTest()"> | 60 <body onload="runTest()"> |
| 43 | 61 |
| 44 <div id="inliner" style="color: red;"> | 62 <div id="inliner" style="color: red;"> |
| 45 </div> | 63 </div> |
| 46 | 64 |
| 47 </body> | 65 </body> |
| 48 </html> | 66 </html> |
| OLD | NEW |