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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/css/css-add-rule.html

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp Created 3 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <link rel="stylesheet" href="resources/add-rule.css"/> 3 <link rel="stylesheet" href="resources/add-rule.css"/>
4 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/inspector-protocol-test.js"></script>
5 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot ocol-test.js"></script> 5 <script type="text/javascript" src="../resources/css-protocol-test.js"></script>
6 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot ocol-test.js"></script> 6 <script type="text/javascript" src="../resources/dom-protocol-test.js"></script>
7 <script type="text/javascript"> 7 <script type="text/javascript">
8 function test() 8 function test()
9 { 9 {
10 var addRule; 10 var addRule;
11 var verifyProtocolError; 11 var verifydpError;
12 var dumpStyleSheet; 12 var dumpStyleSheet;
13 var documentNodeId; 13 var documentNodeId;
14 14
15 InspectorTest.requestDocumentNodeId(onDocumentNodeId); 15 InspectorTest.requestDocumentNodeId(onDocumentNodeId);
16 16
17 function onDocumentNodeId(nodeId) 17 function onDocumentNodeId(nodeId)
18 { 18 {
19 documentNodeId = nodeId; 19 documentNodeId = nodeId;
20 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; 20 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
21 InspectorTest.sendCommandOrDie("CSS.enable", {}); 21 InspectorTest.sendCommandOrDie("CSS.enable", {});
22 } 22 }
23 23
24 function styleSheetAdded(result) 24 function styleSheetAdded(result)
25 { 25 {
26 var styleSheetId = result.params.header.styleSheetId; 26 var styleSheetId = result.params.header.styleSheetId;
27 addRule = InspectorTest.addRule.bind(InspectorTest, styleSheetId, false) ; 27 addRule = InspectorTest.addRule.bind(InspectorTest, styleSheetId, false) ;
28 verifyProtocolError = InspectorTest.addRule.bind(InspectorTest, styleShe etId, true); 28 verifydpError = InspectorTest.addRule.bind(InspectorTest, styleSheetId, true);
29 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d); 29 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d);
30 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText); 30 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
31 } 31 }
32 32
33 function dumpAndNext(next) 33 function dumpAndNext(next)
34 { 34 {
35 return InspectorTest.loadAndDumpMatchingRules.bind(InspectorTest, docume ntNodeId, "#test", InspectorTest.undoAndNext(next)); 35 return InspectorTest.loadAndDumpMatchingRules.bind(InspectorTest, docume ntNodeId, "#test", InspectorTest.undoAndNext(next));
36 } 36 }
37 37
38 function onInitialStyleSheetText(result) 38 function onInitialStyleSheetText(result)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 addRule({ 108 addRule({
109 location: { startLine: 19, startColumn: 0, endLine: 19, endColum n: 0 }, 109 location: { startLine: 19, startColumn: 0, endLine: 19, endColum n: 0 },
110 ruleText: "#test { content: 'EDITED'; }", 110 ruleText: "#test { content: 'EDITED'; }",
111 }, dumpAndNext(next)); 111 }, dumpAndNext(next));
112 }, 112 },
113 113
114 /* Tests that verify error reporting. */ 114 /* Tests that verify error reporting. */
115 115
116 function testInvalidRule(next) 116 function testInvalidRule(next)
117 { 117 {
118 verifyProtocolError({ 118 verifydpError({
119 location: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 }, 119 location: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 },
120 ruleText: "#test { content: 'EDITED';", 120 ruleText: "#test { content: 'EDITED';",
121 }, next); 121 }, next);
122 }, 122 },
123 123
124 function testInvalidRule2(next) 124 function testInvalidRule2(next)
125 { 125 {
126 verifyProtocolError({ 126 verifydpError({
127 location: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 }, 127 location: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 },
128 ruleText: "@media all { ", 128 ruleText: "@media all { ",
129 }, next); 129 }, next);
130 }, 130 },
131 131
132 function testInvalidRule3(next) 132 function testInvalidRule3(next)
133 { 133 {
134 verifyProtocolError({ 134 verifydpError({
135 location: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 }, 135 location: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 },
136 ruleText: "#test {} #test {", 136 ruleText: "#test {} #test {",
137 }, next); 137 }, next);
138 }, 138 },
139 139
140 function testAddingRuleInsideSelector(next) 140 function testAddingRuleInsideSelector(next)
141 { 141 {
142 verifyProtocolError({ 142 verifydpError({
143 location: { startLine: 0, startColumn: 2, endLine: 0, endColumn: 2 }, 143 location: { startLine: 0, startColumn: 2, endLine: 0, endColumn: 2 },
144 ruleText: "#test { content: 'EDITED'; }", 144 ruleText: "#test { content: 'EDITED'; }",
145 }, next); 145 }, next);
146 }, 146 },
147 147
148 function testAddingRuleBeforeRuleBody(next) 148 function testAddingRuleBeforeRuleBody(next)
149 { 149 {
150 verifyProtocolError({ 150 verifydpError({
151 location: { startLine: 4, startColumn: 6, endLine: 4, endColumn: 6 }, 151 location: { startLine: 4, startColumn: 6, endLine: 4, endColumn: 6 },
152 ruleText: "#test { content: 'EDITED'; }", 152 ruleText: "#test { content: 'EDITED'; }",
153 }, next); 153 }, next);
154 }, 154 },
155 155
156 function testAddingRuleInsideMedia1(next) 156 function testAddingRuleInsideMedia1(next)
157 { 157 {
158 verifyProtocolError({ 158 verifydpError({
159 location: { startLine: 12, startColumn: 9, endLine: 12, endColum n: 9 }, 159 location: { startLine: 12, startColumn: 9, endLine: 12, endColum n: 9 },
160 ruleText: "#test { content: 'EDITED'; }", 160 ruleText: "#test { content: 'EDITED'; }",
161 }, next); 161 }, next);
162 }, 162 },
163 163
164 function testAddingRuleInsideMedia2(next) 164 function testAddingRuleInsideMedia2(next)
165 { 165 {
166 verifyProtocolError({ 166 verifydpError({
167 location: { startLine: 12, startColumn: 15, endLine: 12, endColu mn: 15 }, 167 location: { startLine: 12, startColumn: 15, endLine: 12, endColu mn: 15 },
168 ruleText: "#test { content: 'EDITED'; }", 168 ruleText: "#test { content: 'EDITED'; }",
169 }, next); 169 }, next);
170 }, 170 },
171 171
172 function testAddingRuleBeforeMediaBody(next) 172 function testAddingRuleBeforeMediaBody(next)
173 { 173 {
174 verifyProtocolError({ 174 verifydpError({
175 location: { startLine: 12, startColumn: 24, endLine: 12, endColu mn: 24 }, 175 location: { startLine: 12, startColumn: 24, endLine: 12, endColu mn: 24 },
176 ruleText: "#test { content: 'EDITED'; }", 176 ruleText: "#test { content: 'EDITED'; }",
177 }, next); 177 }, next);
178 }, 178 },
179 179
180 function testAddingRuleInsideStyleRule(next) 180 function testAddingRuleInsideStyleRule(next)
181 { 181 {
182 verifyProtocolError({ 182 verifydpError({
183 location: { startLine: 18, startColumn: 0, endLine: 18, endColum n: 0 }, 183 location: { startLine: 18, startColumn: 0, endLine: 18, endColum n: 0 },
184 ruleText: "#test { content: 'EDITED'; }", 184 ruleText: "#test { content: 'EDITED'; }",
185 }, next); 185 }, next);
186 }, 186 },
187 ]; 187 ];
188 } 188 }
189 189
190 </script> 190 </script>
191 </head> 191 </head>
192 <body onload="runTest();"> 192 <body onload="runTest();">
193 <p>The test verifies functionality of protocol method CSS.addRule.</p> 193 <p>The test verifies functionality of protocol method CSS.addRule.</p>
194 <article id="test"></article> 194 <article id="test"></article>
195 </body> 195 </body>
196 </html> 196 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698