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

Side by Side Diff: LayoutTests/inspector-protocol/css/css-set-inline-style-text.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
(Empty)
1 <html>
2 <head>
3 <link rel="stylesheet" href="resources/set-style-text.css"/>
4 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
5 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot ocol-test.js"></script>
6 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot ocol-test.js"></script>
7 <script type="text/javascript">
8 function test()
9 {
10 var styleSheetId;
11 var documentNodeId;
12 var setStyleText;
13 var verifyProtocolError;
14 var dumpStyleSheet;
15
16 InspectorTest.sendCommandOrDie("DOM.enable", {});
17 InspectorTest.sendCommandOrDie("CSS.enable", {}, cssWasEnabled);
18
19 function cssWasEnabled()
20 {
21 InspectorTest.sendCommandOrDie("DOM.getDocument", {}, onGotDocument);
22 }
23
24 function onGotDocument(result)
25 {
26 documentNodeId = result.root.nodeId;
27 InspectorTest.sendCommandOrDie("DOM.querySelector", { nodeId: documentNo deId, selector: "#inliner" }, onGotNode);
28 }
29
30 function onGotNode(node)
31 {
32 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { nodeId: n ode.nodeId }, onGotInlineStyles);
33 }
34
35 function onGotInlineStyles(result)
36 {
37 styleSheetId = result.inlineStyle.styleSheetId;
38 setStyleText = InspectorTest.setStyleText.bind(InspectorTest, styleSheet Id, false);
39 verifyProtocolError = InspectorTest.setStyleText.bind(InspectorTest, sty leSheetId, true);
40 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d);
41 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
42 }
43
44 function dumpAndNext(next)
45 {
46 return function()
47 {
48 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheet Id: styleSheetId }, onReceiveStyleSheetText);
49
50 function onReceiveStyleSheetText(result)
51 {
52 InspectorTest.log("Stylesheet text: " + result.text);
53 InspectorTest.domUndo(next);
54 }
55 }
56 }
57
58 function onInitialStyleSheetText(result)
59 {
60 InspectorTest.log("==== Initial style sheet text ====");
61 InspectorTest.log(result.text);
62 InspectorTest.runTestSuite(testSuite);
63 }
64
65 var testSuite = [
66 function testBasicSetStyle(next)
67 {
68 setStyleText({
69 styleSheetId: styleSheetId,
70 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
71 text: "content: 'EDITED'",
72 }, dumpAndNext(next));
73 },
74
75 function testSetStylePoorContent(next)
76 {
77 verifyProtocolError({
78 styleSheetId: styleSheetId,
79 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
80 text: "}",
81 }, dumpAndNext(next));
82 },
83
84 function testDeleteStyleBody(next)
85 {
86 setStyleText({
87 styleSheetId: styleSheetId,
88 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
89 text: "",
90 }, dumpAndNext(next));
91 },
92
93 function testSetStyleOpenComment(next)
94 {
95 verifyProtocolError({
96 styleSheetId: styleSheetId,
97 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
98 text: "/*",
99 }, dumpAndNext(next));
100 }
101 ];
102 }
103
104 </script>
105 </head>
106 <body onload="runTest();">
107 <p>The test verifies functionality of protocol method CSS.setStyleText for inlin e elements.</p>
108 <div id="inliner" style="color: red;">
109 </body>
110 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698