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

Side by Side Diff: LayoutTests/inspector-protocol/css/css-set-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: 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 setStyleText;
11 var verifyProtocolError;
12 var dumpStyleSheet;
13 var documentNodeId;
14 var styleSheetId;
15
16 InspectorTest.requestDocumentNodeId(onDocumentNodeId);
17
18 function onDocumentNodeId(nodeId)
19 {
20 documentNodeId = nodeId;
21 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
22 InspectorTest.sendCommandOrDie("CSS.enable", {});
23 }
24
25 function styleSheetAdded(result)
26 {
27 styleSheetId = result.params.header.styleSheetId;
28 setStyleText = InspectorTest.setStyleText.bind(InspectorTest, styleSheet Id, false);
29 verifyProtocolError = InspectorTest.setStyleText.bind(InspectorTest, sty leSheetId, true);
30 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d);
31 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
32 }
33
34 function dumpAndNext(next)
35 {
36 return InspectorTest.loadAndDumpMatchingRules.bind(InspectorTest, docume ntNodeId, "#test", InspectorTest.undoAndNext(next));
37 }
38
39 function onInitialStyleSheetText(result)
40 {
41 InspectorTest.log("==== Initial style sheet text ====");
42 InspectorTest.log(result.text);
43 InspectorTest.runTestSuite(testSuite);
44 }
45
46 var testSuite = [
47 /* Tests that add rule into style sheet. */
48
49 function testBasicSetStyle(next)
50 {
51 setStyleText({
52 styleSheetId: styleSheetId,
53 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
54 text: "\n content: 'EDITED';\n",
55 }, dumpAndNext(next));
lushnikov 2015/06/17 13:55:10 let's rather use undoAndNext. This way all tests f
56 },
57
58 function testSetStylePoorContent(next)
59 {
60 verifyProtocolError({
61 styleSheetId: styleSheetId,
62 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
63 text: "}",
64 }, dumpAndNext(next));
65 },
66
67 function testSetStyleInMedia(next)
68 {
69 setStyleText({
70 styleSheetId: styleSheetId,
71 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
72 text: "\n content: 'EDITED';\n color: red;\n /** foo */\n ",
73 }, dumpAndNext(next));
74 },
75
76 function testSetStylePoorRange(next)
77 {
78 verifyProtocolError({
79 styleSheetId: styleSheetId,
80 range: { startLine: 11, startColumn: 11, endLine: 15, endColumn: 4 },
81 text: "\n content: 'EDITED';\n",
82 }, dumpAndNext(next));
83 }
lushnikov 2015/06/17 13:58:04 let add also: 1. editing of inline style 2. editin
84 ];
85 }
86
87 </script>
88 </head>
89 <body onload="runTest();">
90 <p>The test verifies functionality of protocol method CSS.setStyleText.</p>
91 <article id="test"></article>
92 </body>
93 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698