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

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

Issue 1181213007: DevTools: introduce CSS.setStyleText, we'll migrate setPropertyText to it later. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: win fixed Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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 9
22 InspectorTest.sendCommand("CSS.enable", {}, cssWasEnabled); 10 InspectorTest.sendCommand("CSS.enable", {}, cssWasEnabled);
23 11
24 function cssWasEnabled() 12 function cssWasEnabled()
25 { 13 {
26 sendCommand("DOM.getDocument", {}, onGotDocument); 14 InspectorTest.sendCommandOrDie("DOM.getDocument", {}, onGotDocument);
27 } 15 }
28 16
29 function onGotDocument(result) 17 function onGotDocument(result)
30 { 18 {
31 var root = result.root; 19 var root = result.root;
32 sendCommand("DOM.querySelector", { 20 InspectorTest.sendCommandOrDie("DOM.querySelector", {
33 nodeId: root.nodeId, 21 nodeId: root.nodeId,
34 selector: "#inliner" 22 selector: "#inliner"
35 }, onGotNode); 23 }, onGotNode);
36 } 24 }
37 25
38 function onGotNode(node) 26 function onGotNode(node)
39 { 27 {
40 sendCommand("CSS.getInlineStylesForNode", { nodeId: node.nodeId }, onGot InlineStyles); 28 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { nodeId: n ode.nodeId }, onGotInlineStyles);
41 } 29 }
42 30
43 function onGotInlineStyles(result) 31 function onGotInlineStyles(result)
44 { 32 {
45 inlineStyleSheetId = result.inlineStyle.styleSheetId; 33 inlineStyleSheetId = result.inlineStyle.styleSheetId;
46 sendCommand("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId }, onReceiveStyleSheetText); 34 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId }, onReceiveStyleSheetText);
47 } 35 }
48 36
49 function onReceiveStyleSheetText(result) 37 function onReceiveStyleSheetText(result)
50 { 38 {
51 InspectorTest.log(result.text); 39 InspectorTest.log(result.text);
52 sendCommand("CSS.setStyleSheetText", { 40 InspectorTest.sendCommandOrDie("CSS.setStyleSheetText", {
53 styleSheetId: inlineStyleSheetId, 41 styleSheetId: inlineStyleSheetId,
54 text: "border: 1px solid black;" 42 text: "border: 1px solid black;"
55 }, onSetStyleSheetBody); 43 }, onSetStyleSheetBody);
56 } 44 }
57 45
58 function onSetStyleSheetBody(result) 46 function onSetStyleSheetBody(result)
59 { 47 {
60 sendCommand("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId }, onCheckStyleSheetBody); 48 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: inlineStyleSheetId }, onCheckStyleSheetBody);
61 } 49 }
62 50
63 function onCheckStyleSheetBody(result) 51 function onCheckStyleSheetBody(result)
64 { 52 {
65 InspectorTest.log(result.text); 53 InspectorTest.log(result.text);
66 InspectorTest.completeTest(); 54 InspectorTest.completeTest();
67 } 55 }
68 }; 56 };
69 57
70 </script> 58 </script>
71 </head> 59 </head>
72 <body onload="runTest()"> 60 <body onload="runTest()">
73 61
74 <div id="inliner" style="color: red;"> 62 <div id="inliner" style="color: red;">
75 </div> 63 </div>
76 64
77 </body> 65 </body>
78 </html> 66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698