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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/css-protocol-test.js

Issue 1694433003: DevTools: [CSS] Add CSS.setMultipleStyleTexts command to CSS domain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 10 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 function initialize_cssTest() 1 function initialize_cssTest()
2 { 2 {
3 3
4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) 4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback)
5 { 5 {
6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl eSheetId }, onStyleSheetText); 6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl eSheetId }, onStyleSheetText);
7 function onStyleSheetText(result) 7 function onStyleSheetText(result)
8 { 8 {
9 InspectorTest.log("==== Style sheet text ===="); 9 InspectorTest.log("==== Style sheet text ====");
10 InspectorTest.log(result.text); 10 InspectorTest.log(result.text);
11 callback(); 11 callback();
12 } 12 }
13 } 13 }
14 14
15 function updateStyleSheetRange(command, styleSheetId, expectError, options, call back) 15 function modifyStyleSheet(command, styleSheetId, expectError, options, callback)
16 { 16 {
17 options.styleSheetId = styleSheetId; 17 options.styleSheetId = styleSheetId;
dgozman 2016/02/17 23:32:35 This does not work for multiple edits.
lushnikov 2016/02/18 01:40:16 This affects only styleSheet text to be dumped.
18 if (expectError) 18 if (expectError)
19 InspectorTest.sendCommand(command, options, onResponse); 19 InspectorTest.sendCommand(command, options, onResponse);
20 else 20 else
21 InspectorTest.sendCommandOrDie(command, options, onSuccess); 21 InspectorTest.sendCommandOrDie(command, options, onSuccess);
22 22
23 function onSuccess() 23 function onSuccess()
24 { 24 {
25 InspectorTest.dumpStyleSheetText(styleSheetId, callback); 25 InspectorTest.dumpStyleSheetText(styleSheetId, callback);
26 } 26 }
27 27
28 function onResponse(message) 28 function onResponse(message)
29 { 29 {
30 if (!message.error) { 30 if (!message.error) {
31 InspectorTest.log("ERROR: protocol method call did not return expect ed error. Instead, the following message was received: " + JSON.stringify(messag e)); 31 InspectorTest.log("ERROR: protocol method call did not return expect ed error. Instead, the following message was received: " + JSON.stringify(messag e));
32 InspectorTest.completeTest(); 32 InspectorTest.completeTest();
33 return; 33 return;
34 } 34 }
35 InspectorTest.log("Expected protocol error: " + message.error.message); 35 InspectorTest.log("Expected protocol error: " + message.error.message);
36 callback(); 36 callback();
37 } 37 }
38 } 38 }
39 39
40 InspectorTest.setPropertyText = updateStyleSheetRange.bind(null, "CSS.setPropert yText"); 40 InspectorTest.setPropertyText = modifyStyleSheet.bind(null, "CSS.setPropertyText ");
41 InspectorTest.setRuleSelector = updateStyleSheetRange.bind(null, "CSS.setRuleSel ector"); 41 InspectorTest.setRuleSelector = modifyStyleSheet.bind(null, "CSS.setRuleSelector ");
42 InspectorTest.setStyleText = updateStyleSheetRange.bind(null, "CSS.setStyleText" ); 42 InspectorTest.setMediaText = modifyStyleSheet.bind(null, "CSS.setMediaText");
43 InspectorTest.setMediaText = updateStyleSheetRange.bind(null, "CSS.setMediaText" ); 43 InspectorTest.addRule = modifyStyleSheet.bind(null, "CSS.addRule");
44 InspectorTest.addRule = updateStyleSheetRange.bind(null, "CSS.addRule"); 44 InspectorTest.setStyleTexts = function(styleSheetId, expectError, edits, callbac k)
45 {
46 var options = { edits: edits };
47 modifyStyleSheet("CSS.setStyleTexts", styleSheetId, expectError, options, ca llback);
48 }
45 49
46 InspectorTest.requestMainFrameId = function(callback) 50 InspectorTest.requestMainFrameId = function(callback)
47 { 51 {
48 InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled); 52 InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled);
49 53
50 function pageEnabled() 54 function pageEnabled()
51 { 55 {
52 InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeL oaded); 56 InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeL oaded);
53 } 57 }
54 58
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 { 193 {
190 if (!omitLog) 194 if (!omitLog)
191 InspectorTest.log("Dumping inline style: "); 195 InspectorTest.log("Dumping inline style: ");
192 InspectorTest.log("{"); 196 InspectorTest.log("{");
193 InspectorTest.dumpStyle(result.inlineStyle, 0); 197 InspectorTest.dumpStyle(result.inlineStyle, 0);
194 InspectorTest.log("}"); 198 InspectorTest.log("}");
195 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, callback, omitLog) 199 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, callback, omitLog)
196 } 200 }
197 } 201 }
198 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698