| OLD | NEW |
| 1 function initialize_cssTest() | 1 function initialize_cssTest() |
| 2 { | 2 { |
| 3 | 3 |
| 4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) | 4 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) |
| 5 { | 5 { |
| 6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl
eSheetId }, onStyleSheetText); | 6 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl
eSheetId }, onStyleSheetText); |
| 7 function onStyleSheetText(result) | 7 function onStyleSheetText(result) |
| 8 { | 8 { |
| 9 InspectorTest.log("==== Style sheet text ===="); | 9 InspectorTest.log("==== Style sheet text ===="); |
| 10 InspectorTest.log(result.text); | 10 InspectorTest.log(result.text); |
| 11 callback(); | 11 callback(); |
| 12 } | 12 } |
| 13 } | 13 } |
| 14 | 14 |
| 15 function updateStyleSheetRange(command, styleSheetId, expectError, options, call
back) | 15 function modifyStyleSheet(command, presetStyleSheetId, styleSheetId, expectError
, options, callback) |
| 16 { | 16 { |
| 17 options.styleSheetId = styleSheetId; | 17 if (presetStyleSheetId) |
| 18 options.styleSheetId = styleSheetId; |
| 18 if (expectError) | 19 if (expectError) |
| 19 InspectorTest.sendCommand(command, options, onResponse); | 20 InspectorTest.sendCommand(command, options, onResponse); |
| 20 else | 21 else |
| 21 InspectorTest.sendCommandOrDie(command, options, onSuccess); | 22 InspectorTest.sendCommandOrDie(command, options, onSuccess); |
| 22 | 23 |
| 23 function onSuccess() | 24 function onSuccess() |
| 24 { | 25 { |
| 25 InspectorTest.dumpStyleSheetText(styleSheetId, callback); | 26 InspectorTest.dumpStyleSheetText(styleSheetId, callback); |
| 26 } | 27 } |
| 27 | 28 |
| 28 function onResponse(message) | 29 function onResponse(message) |
| 29 { | 30 { |
| 30 if (!message.error) { | 31 if (!message.error) { |
| 31 InspectorTest.log("ERROR: protocol method call did not return expect
ed error. Instead, the following message was received: " + JSON.stringify(messag
e)); | 32 InspectorTest.log("ERROR: protocol method call did not return expect
ed error. Instead, the following message was received: " + JSON.stringify(messag
e)); |
| 32 InspectorTest.completeTest(); | 33 InspectorTest.completeTest(); |
| 33 return; | 34 return; |
| 34 } | 35 } |
| 35 InspectorTest.log("Expected protocol error: " + message.error.message); | 36 InspectorTest.log("Expected protocol error: " + message.error.message); |
| 36 callback(); | 37 callback(); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 InspectorTest.setPropertyText = updateStyleSheetRange.bind(null, "CSS.setPropert
yText"); | 41 InspectorTest.setPropertyText = modifyStyleSheet.bind(null, "CSS.setPropertyText
", true); |
| 41 InspectorTest.setRuleSelector = updateStyleSheetRange.bind(null, "CSS.setRuleSel
ector"); | 42 InspectorTest.setRuleSelector = modifyStyleSheet.bind(null, "CSS.setRuleSelector
", true); |
| 42 InspectorTest.setStyleText = updateStyleSheetRange.bind(null, "CSS.setStyleText"
); | 43 InspectorTest.setMediaText = modifyStyleSheet.bind(null, "CSS.setMediaText", tru
e); |
| 43 InspectorTest.setMediaText = updateStyleSheetRange.bind(null, "CSS.setMediaText"
); | 44 InspectorTest.addRule = modifyStyleSheet.bind(null, "CSS.addRule", true); |
| 44 InspectorTest.addRule = updateStyleSheetRange.bind(null, "CSS.addRule"); | 45 InspectorTest.setStyleTexts = function(styleSheetId, expectError, edits, callbac
k) |
| 46 { |
| 47 var options = { edits: edits }; |
| 48 modifyStyleSheet("CSS.setStyleTexts", false, styleSheetId, expectError, opti
ons, callback); |
| 49 } |
| 45 | 50 |
| 46 InspectorTest.requestMainFrameId = function(callback) | 51 InspectorTest.requestMainFrameId = function(callback) |
| 47 { | 52 { |
| 48 InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled); | 53 InspectorTest.sendCommandOrDie("Page.enable", {}, pageEnabled); |
| 49 | 54 |
| 50 function pageEnabled() | 55 function pageEnabled() |
| 51 { | 56 { |
| 52 InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeL
oaded); | 57 InspectorTest.sendCommandOrDie("Page.getResourceTree", {}, resourceTreeL
oaded); |
| 53 } | 58 } |
| 54 | 59 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 { | 194 { |
| 190 if (!omitLog) | 195 if (!omitLog) |
| 191 InspectorTest.log("Dumping inline style: "); | 196 InspectorTest.log("Dumping inline style: "); |
| 192 InspectorTest.log("{"); | 197 InspectorTest.log("{"); |
| 193 InspectorTest.dumpStyle(result.inlineStyle, 0); | 198 InspectorTest.dumpStyle(result.inlineStyle, 0); |
| 194 InspectorTest.log("}"); | 199 InspectorTest.log("}"); |
| 195 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, callback, omitLog) | 200 InspectorTest.loadAndDumpMatchingRulesForNode(nodeId, callback, omitLog) |
| 196 } | 201 } |
| 197 } | 202 } |
| 198 } | 203 } |
| OLD | NEW |