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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector-protocol/css/css-protocol-test.js
diff --git a/LayoutTests/inspector-protocol/css/css-protocol-test.js b/LayoutTests/inspector-protocol/css/css-protocol-test.js
index 4c83d841aadaf89e46d520de7d9e0efa8c6ec57f..3c05da9e6064f42856f443ca0e409a296892741a 100644
--- a/LayoutTests/inspector-protocol/css/css-protocol-test.js
+++ b/LayoutTests/inspector-protocol/css/css-protocol-test.js
@@ -1,6 +1,44 @@
function initialize_cssTest()
{
+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.setPropertyText = function(styleSheetId, expectError, options, callback)
+{
+ var styleId = { styleSheetId: styleSheetId, ordinal: options.styleIndex };
+ delete options.styleIndex;
+ options.styleId = styleId;
+ if (expectError)
+ InspectorTest.sendCommand("CSS.setPropertyText", options, onResponse);
+ else
+ InspectorTest.sendCommandOrDie("CSS.setPropertyText", options, onSuccess);
+
+ function onSuccess()
+ {
+ InspectorTest.dumpStyleSheetText(styleSheetId, callback);
+ }
+
+ function onResponse(message)
+ {
+ if (!message.error) {
+ InspectorTest.log("ERROR: protocol method call did not return expected error. Instead, the following message was received: " + JSON.stringify(message));
+ InspectorTest.completeTest();
+ return;
+ }
+ InspectorTest.log("Expected protocol error: " + message.error.message);
+ callback();
+ }
+}
+
InspectorTest.requestMainFrameId = function(callback)
{
InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled);
@@ -105,4 +143,4 @@ InspectorTest.loadAndDumpMatchingRules = function(nodeId, callback)
}
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698