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