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

Unified Diff: LayoutTests/inspector-protocol/css/edit-range-utils.js

Issue 172593003: DevTools: [CSS] Add CSS.editRangeInStyleSheetText() to the protocol (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix glitch 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 side-by-side diff with in-line comments
Download patch
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();
+ }
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698