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

Side by Side Diff: LayoutTests/inspector-protocol/css/css-protocol-test.js

Issue 211193006: DevTools: [CSS] use setStyleText as undo action for setPropertyText (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add testcase Created 6 years, 9 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 function initialize_cssTest() 1 function initialize_cssTest()
2 { 2 {
3 3
4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback)
5 {
6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl eSheetId }, onStyleSheetText);
7 function onStyleSheetText(result)
8 {
9 InspectorTest.log("==== Style sheet text ====");
10 InspectorTest.log(result.text);
11 callback();
12 }
13 }
14
15 InspectorTest.setPropertyText = function(styleSheetId, expectError, options, cal lback)
16 {
17 var styleId = { styleSheetId: styleSheetId, ordinal: options.styleIndex };
18 delete options.styleIndex;
19 options.styleId = styleId;
20 if (expectError)
21 InspectorTest.sendCommand("CSS.setPropertyText", options, onResponse);
22 else
23 InspectorTest.sendCommandOrDie("CSS.setPropertyText", options, onSuccess );
24
25 function onSuccess()
26 {
27 InspectorTest.dumpStyleSheetText(styleSheetId, callback);
28 }
29
30 function onResponse(message)
31 {
32 if (!message.error) {
33 InspectorTest.log("ERROR: protocol method call did not return expect ed error. Instead, the following message was received: " + JSON.stringify(messag e));
34 InspectorTest.completeTest();
35 return;
36 }
37 InspectorTest.log("Expected protocol error: " + message.error.message);
38 callback();
39 }
40 }
41
4 InspectorTest.requestMainFrameId = function(callback) 42 InspectorTest.requestMainFrameId = function(callback)
5 { 43 {
6 InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled); 44 InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled);
7 45
8 function pageEnabled() 46 function pageEnabled()
9 { 47 {
10 InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeL oaded); 48 InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeL oaded);
11 } 49 }
12 50
13 function resourceTreeLoaded(payload) 51 function resourceTreeLoaded(payload)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 var ruleMatch = ruleMatches[i]; 136 var ruleMatch = ruleMatches[i];
99 var origin = ruleMatch.rule.origin; 137 var origin = ruleMatch.rule.origin;
100 if (origin !== "inspector" && origin !== "regular") 138 if (origin !== "inspector" && origin !== "regular")
101 continue; 139 continue;
102 InspectorTest.dumpRuleMatch(ruleMatch); 140 InspectorTest.dumpRuleMatch(ruleMatch);
103 } 141 }
104 callback(); 142 callback();
105 } 143 }
106 } 144 }
107 145
108 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698