| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <link rel="stylesheet" href="resources/set-style-text.css"/> | 3 <link rel="stylesheet" href="resources/set-style-text.css"/> |
| 4 <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/resource
s/inspector-protocol-test.js"></script> |
| 5 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot
ocol-test.js"></script> | 5 <script type="text/javascript" src="../resources/css-protocol-test.js"></script> |
| 6 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot
ocol-test.js"></script> | 6 <script type="text/javascript" src="../resources/dom-protocol-test.js"></script> |
| 7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
| 8 | 8 |
| 9 function test() | 9 function test() |
| 10 { | 10 { |
| 11 var setStyleTexts; | 11 var setStyleTexts; |
| 12 var verifyProtocolError; | 12 var verifydpError; |
| 13 var styleSheetId; | 13 var styleSheetId; |
| 14 var undoAndNext = InspectorTest.undoAndNext; | 14 var undoAndNext = InspectorTest.undoAndNext; |
| 15 | 15 |
| 16 InspectorTest.requestDocumentNodeId(onDocumentNodeId); | 16 InspectorTest.requestDocumentNodeId(onDocumentNodeId); |
| 17 | 17 |
| 18 function onDocumentNodeId(nodeId) | 18 function onDocumentNodeId(nodeId) |
| 19 { | 19 { |
| 20 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; | 20 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; |
| 21 InspectorTest.sendCommandOrDie("CSS.enable", {}); | 21 InspectorTest.sendCommandOrDie("CSS.enable", {}); |
| 22 } | 22 } |
| 23 | 23 |
| 24 function styleSheetAdded(result) | 24 function styleSheetAdded(result) |
| 25 { | 25 { |
| 26 styleSheetId = result.params.header.styleSheetId; | 26 styleSheetId = result.params.header.styleSheetId; |
| 27 setStyleTexts = InspectorTest.setStyleTexts.bind(InspectorTest, styleShe
etId, false); | 27 setStyleTexts = InspectorTest.setStyleTexts.bind(InspectorTest, styleShe
etId, false); |
| 28 verifyProtocolError = InspectorTest.setStyleTexts.bind(InspectorTest, st
yleSheetId, true); | 28 verifydpError = InspectorTest.setStyleTexts.bind(InspectorTest, styleShe
etId, true); |
| 29 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
styleSheetId }, onInitialStyleSheetText); | 29 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
styleSheetId }, onInitialStyleSheetText); |
| 30 } | 30 } |
| 31 | 31 |
| 32 function onInitialStyleSheetText(result) | 32 function onInitialStyleSheetText(result) |
| 33 { | 33 { |
| 34 InspectorTest.log("==== Initial style sheet text ===="); | 34 InspectorTest.log("==== Initial style sheet text ===="); |
| 35 InspectorTest.log(result.text); | 35 InspectorTest.log(result.text); |
| 36 InspectorTest.runTestSuite(testSuite); | 36 InspectorTest.runTestSuite(testSuite); |
| 37 } | 37 } |
| 38 | 38 |
| 39 var testSuite = [ | 39 var testSuite = [ |
| 40 function testMalformedArguments1(next) | 40 function testMalformedArguments1(next) |
| 41 { | 41 { |
| 42 verifyProtocolError([ | 42 verifydpError([ |
| 43 { | 43 { |
| 44 styleSheetId: styleSheetId, | 44 styleSheetId: styleSheetId, |
| 45 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, | 45 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, |
| 46 text: "\n content: 'EDITED';\n", | 46 text: "\n content: 'EDITED';\n", |
| 47 }, | 47 }, |
| 48 { | 48 { |
| 49 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, | 49 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, |
| 50 text: "\n content: 'EDITED';\n", | 50 text: "\n content: 'EDITED';\n", |
| 51 }, | 51 }, |
| 52 ], next); | 52 ], next); |
| 53 }, | 53 }, |
| 54 | 54 |
| 55 function testMalformedArguments2(next) | 55 function testMalformedArguments2(next) |
| 56 { | 56 { |
| 57 verifyProtocolError([ | 57 verifydpError([ |
| 58 { | 58 { |
| 59 styleSheetId: styleSheetId, | 59 styleSheetId: styleSheetId, |
| 60 }, | 60 }, |
| 61 { | 61 { |
| 62 styleSheetId: styleSheetId, | 62 styleSheetId: styleSheetId, |
| 63 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, | 63 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, |
| 64 text: "\n content: 'EDITED';\n", | 64 text: "\n content: 'EDITED';\n", |
| 65 }, | 65 }, |
| 66 { | 66 { |
| 67 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, | 67 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, |
| 68 text: "\n content: 'EDITED';\n", | 68 text: "\n content: 'EDITED';\n", |
| 69 }, | 69 }, |
| 70 ], next); | 70 ], next); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 function testMalformedArguments3(next) | 73 function testMalformedArguments3(next) |
| 74 { | 74 { |
| 75 verifyProtocolError([ | 75 verifydpError([ |
| 76 { | 76 { |
| 77 styleSheetId: styleSheetId, | 77 styleSheetId: styleSheetId, |
| 78 range: { startLine: "STRING INSTEAD OF NUMBER", startColumn:
11, endLine: 15, endColumn: 4 }, | 78 range: { startLine: "STRING INSTEAD OF NUMBER", startColumn:
11, endLine: 15, endColumn: 4 }, |
| 79 text: "\n content: 'EDITED';\n", | 79 text: "\n content: 'EDITED';\n", |
| 80 }, | 80 }, |
| 81 { | 81 { |
| 82 styleSheetId: styleSheetId, | 82 styleSheetId: styleSheetId, |
| 83 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, | 83 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, |
| 84 text: "\n content: 'EDITED';\n", | 84 text: "\n content: 'EDITED';\n", |
| 85 }, | 85 }, |
| 86 ], next); | 86 ], next); |
| 87 }, | 87 }, |
| 88 | 88 |
| 89 function testFirstEditDoesNotApply(next) | 89 function testFirstEditDoesNotApply(next) |
| 90 { | 90 { |
| 91 verifyProtocolError([ | 91 verifydpError([ |
| 92 { | 92 { |
| 93 styleSheetId: styleSheetId, | 93 styleSheetId: styleSheetId, |
| 94 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, | 94 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, |
| 95 text: "\n content: 'EDITED';/*\n", | 95 text: "\n content: 'EDITED';/*\n", |
| 96 }, | 96 }, |
| 97 { | 97 { |
| 98 styleSheetId: styleSheetId, | 98 styleSheetId: styleSheetId, |
| 99 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, | 99 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, |
| 100 text: "\n content: 'EDITED';\n", | 100 text: "\n content: 'EDITED';\n", |
| 101 }, | 101 }, |
| 102 ], next); | 102 ], next); |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 function testSecondEditDoesNotApply(next) | 105 function testSecondEditDoesNotApply(next) |
| 106 { | 106 { |
| 107 verifyProtocolError([ | 107 verifydpError([ |
| 108 { | 108 { |
| 109 styleSheetId: styleSheetId, | 109 styleSheetId: styleSheetId, |
| 110 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, | 110 range: { startLine: 13, startColumn: 11, endLine: 15, endCol
umn: 4 }, |
| 111 text: "\n content: 'EDITED';\n", | 111 text: "\n content: 'EDITED';\n", |
| 112 }, | 112 }, |
| 113 { | 113 { |
| 114 styleSheetId: styleSheetId, | 114 styleSheetId: styleSheetId, |
| 115 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, | 115 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn
: 0 }, |
| 116 text: "\n content: 'EDITED';/*\n", | 116 text: "\n content: 'EDITED';/*\n", |
| 117 }, | 117 }, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ]; | 168 ]; |
| 169 } | 169 } |
| 170 | 170 |
| 171 </script> | 171 </script> |
| 172 </head> | 172 </head> |
| 173 <body onload="runTest();"> | 173 <body onload="runTest();"> |
| 174 <p>The test verifies functionality of protocol method CSS.setStyleTexts.</p> | 174 <p>The test verifies functionality of protocol method CSS.setStyleTexts.</p> |
| 175 <article id="test"></article> | 175 <article id="test"></article> |
| 176 </body> | 176 </body> |
| 177 </html> | 177 </html> |
| OLD | NEW |