Chromium Code Reviews| Index: LayoutTests/inspector-protocol/css/edit-range-utils.js |
| diff --git a/LayoutTests/inspector-protocol/css/edit-range-utils.js b/LayoutTests/inspector-protocol/css/edit-range-utils.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..200a5516745b93c12258965d2ce491bfc0c6facc |
| --- /dev/null |
| +++ b/LayoutTests/inspector-protocol/css/edit-range-utils.js |
| @@ -0,0 +1,60 @@ |
| +var initialize_EditRangeHelpers = function() { |
|
vsevik
2014/03/13 10:44:51
This could be put in css-protocol-test.js
|
| + |
| +InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) |
| +{ |
| + InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onStyleSheetText); |
| + function onStyleSheetText(result) |
| + { |
| + InspectorTest.log("==== Style sheet text ===="); |
| + InspectorTest.log(result.text); |
| + callback(); |
| + } |
| +} |
| + |
| +InspectorTest.editStyleSheet = function(styleSheetId, options, callback, dump) |
| +{ |
| + options.styleSheetId = styleSheetId; |
| + InspectorTest.sendCommandOrDie("CSS.editRangeInStyleSheetText", options, onEditDone); |
| + function onEditDone(msg) |
| + { |
| + if (msg.rule) { |
| + InspectorTest.log("=== updated RULE ==="); |
| + InspectorTest.dumpRule(msg.rule); |
| + } else if (msg.style) { |
| + InspectorTest.log("=== updated STYLE ==="); |
| + InspectorTest.dumpStyle(msg.style); |
| + } |
| + if (dump) |
| + InspectorTest.dumpStyleSheetText(styleSheetId, callback) |
| + else |
| + callback(); |
| + } |
| +} |
| + |
| +InspectorTest.undoAndNext = function(next) |
|
vsevik
2014/03/13 10:44:51
This seems to complicated.
|
| +{ |
| + function undoAndNextInner() |
| + { |
| + InspectorTest.sendCommandOrDie("DOM.undo", null, next); |
| + } |
| + return undoAndNextInner; |
| +} |
| + |
| +InspectorTest.checkProtocolError = function(styleSheetId, options, callback) |
|
vsevik
2014/03/13 10:44:51
InspectorTest.editStyleSheetExpectError
|
| +{ |
| + options.styleSheetId = styleSheetId; |
| + InspectorTest.sendCommand("CSS.editRangeInStyleSheetText", options, onComplete); |
| + |
| + function onComplete(message) |
| + { |
| + if (!message.error) { |
| + InspectorTest.log("ERROR: protocol method call did not raise expected error. Instead, the following message was received: " + JSON.stringify(message)); |
| + InspectorTest.completeTest(); |
| + return; |
| + } |
| + InspectorTest.log("Expected protocol error: " + message.error.message); |
| + callback(); |
| + } |
| +} |
| + |
| +} |