| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | |
| 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot
ocol-test.js"></script> | |
| 5 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot
ocol-test.js"></script> | |
| 6 <script type="text/javascript"> | |
| 7 function test() | |
| 8 { | |
| 9 var setPropertyText; | |
| 10 var verifyProtocolError; | |
| 11 var dumpStyleSheet; | |
| 12 var documentNodeId; | |
| 13 | |
| 14 InspectorTest.requestDocumentNodeId(onDocumentNodeReceived); | |
| 15 | |
| 16 function onDocumentNodeReceived(nodeId) | |
| 17 { | |
| 18 documentNodeId = nodeId; | |
| 19 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled); | |
| 20 } | |
| 21 | |
| 22 function onCSSEnabled() | |
| 23 { | |
| 24 InspectorTest.requestNodeId(documentNodeId, "#reddiv", onNodeRecieved); | |
| 25 } | |
| 26 | |
| 27 function onNodeRecieved(nodeId) | |
| 28 { | |
| 29 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { | |
| 30 nodeId: nodeId, | |
| 31 }, onInlineStyleRecieved); | |
| 32 } | |
| 33 | |
| 34 function onInlineStyleRecieved(result) | |
| 35 { | |
| 36 var styleSheetId = result.inlineStyle.styleSheetId; | |
| 37 setPropertyText = InspectorTest.setPropertyText.bind(InspectorTest, styl
eSheetId, false); | |
| 38 verifyProtocolError = InspectorTest.setPropertyText.bind(InspectorTest,
styleSheetId, true); | |
| 39 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI
d); | |
| 40 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
styleSheetId }, onInitialStyleSheetText); | |
| 41 } | |
| 42 | |
| 43 function onInitialStyleSheetText(result) | |
| 44 { | |
| 45 InspectorTest.log("==== Initial style sheet text ===="); | |
| 46 InspectorTest.log(result.text); | |
| 47 InspectorTest.runTestSuite(testSuite); | |
| 48 } | |
| 49 | |
| 50 var testSuite = [ | |
| 51 function testEditProperty(next) | |
| 52 { | |
| 53 setPropertyText({ | |
| 54 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11
}, | |
| 55 text: "content: 'EDITED PROPERTY';" | |
| 56 }, InspectorTest.undoAndNext(next)); | |
| 57 }, | |
| 58 | |
| 59 function testBreakingCommentEditProperty(next) | |
| 60 { | |
| 61 verifyProtocolError({ | |
| 62 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11
}, | |
| 63 text: "/*<--OPENED COMMENT" | |
| 64 }, next); | |
| 65 }, | |
| 66 | |
| 67 function testInsertFirstProperty(next) | |
| 68 { | |
| 69 setPropertyText({ | |
| 70 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0
}, | |
| 71 text: "content: 'INSERTED PROPERTY';" | |
| 72 }, InspectorTest.undoAndNext(next)); | |
| 73 }, | |
| 74 | |
| 75 function testInsertMultipleProperties(next) | |
| 76 { | |
| 77 setPropertyText({ | |
| 78 range: { startLine: 0, startColumn: 11, endLine: 0, endColumn: 1
1 }, | |
| 79 text: "content: 'INSERTED #1';content: 'INSERTED #2';" | |
| 80 }, InspectorTest.undoAndNext(next)); | |
| 81 }, | |
| 82 | |
| 83 function testInsertLastProperty(next) | |
| 84 { | |
| 85 setPropertyText({ | |
| 86 range: { startLine: 0, startColumn: 24, endLine: 0, endColumn: 2
4 }, | |
| 87 text: "content: 'INSERTED PROPERTY';" | |
| 88 }, InspectorTest.undoAndNext(next)); | |
| 89 }, | |
| 90 ]; | |
| 91 } | |
| 92 | |
| 93 </script> | |
| 94 </head> | |
| 95 <body onload="runTest();"> | |
| 96 <div id="reddiv" style="color: red; border: 0px;">Some red text goes here</d
iv> | |
| 97 </body> | |
| 98 </html> | |
| OLD | NEW |