Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 var initialize_EditRangeHelpers = function() { | |
|
vsevik
2014/03/13 10:44:51
This could be put in css-protocol-test.js
| |
| 2 | |
| 3 InspectorTest.dumpStyleSheetText = function(styleSheetId, callback) | |
| 4 { | |
| 5 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styl eSheetId }, onStyleSheetText); | |
| 6 function onStyleSheetText(result) | |
| 7 { | |
| 8 InspectorTest.log("==== Style sheet text ===="); | |
| 9 InspectorTest.log(result.text); | |
| 10 callback(); | |
| 11 } | |
| 12 } | |
| 13 | |
| 14 InspectorTest.editStyleSheet = function(styleSheetId, options, callback, dump) | |
| 15 { | |
| 16 options.styleSheetId = styleSheetId; | |
| 17 InspectorTest.sendCommandOrDie("CSS.editRangeInStyleSheetText", options, onE ditDone); | |
| 18 function onEditDone(msg) | |
| 19 { | |
| 20 if (msg.rule) { | |
| 21 InspectorTest.log("=== updated RULE ==="); | |
| 22 InspectorTest.dumpRule(msg.rule); | |
| 23 } else if (msg.style) { | |
| 24 InspectorTest.log("=== updated STYLE ==="); | |
| 25 InspectorTest.dumpStyle(msg.style); | |
| 26 } | |
| 27 if (dump) | |
| 28 InspectorTest.dumpStyleSheetText(styleSheetId, callback) | |
| 29 else | |
| 30 callback(); | |
| 31 } | |
| 32 } | |
| 33 | |
| 34 InspectorTest.undoAndNext = function(next) | |
|
vsevik
2014/03/13 10:44:51
This seems to complicated.
| |
| 35 { | |
| 36 function undoAndNextInner() | |
| 37 { | |
| 38 InspectorTest.sendCommandOrDie("DOM.undo", null, next); | |
| 39 } | |
| 40 return undoAndNextInner; | |
| 41 } | |
| 42 | |
| 43 InspectorTest.checkProtocolError = function(styleSheetId, options, callback) | |
|
vsevik
2014/03/13 10:44:51
InspectorTest.editStyleSheetExpectError
| |
| 44 { | |
| 45 options.styleSheetId = styleSheetId; | |
| 46 InspectorTest.sendCommand("CSS.editRangeInStyleSheetText", options, onComple te); | |
| 47 | |
| 48 function onComplete(message) | |
| 49 { | |
| 50 if (!message.error) { | |
| 51 InspectorTest.log("ERROR: protocol method call did not raise expecte d error. Instead, the following message was received: " + JSON.stringify(message )); | |
| 52 InspectorTest.completeTest(); | |
| 53 return; | |
| 54 } | |
| 55 InspectorTest.log("Expected protocol error: " + message.error.message); | |
| 56 callback(); | |
| 57 } | |
| 58 } | |
| 59 | |
| 60 } | |
| OLD | NEW |