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) |
} |
} |
-} |
+} |