| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> |
| 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot
ocol-test.js"></script> | 4 <script type="text/javascript" src="../resources/css-protocol-test.js"></script> |
| 5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; | 8 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; |
| 9 InspectorTest.sendCommandOrDie("DOM.enable", {}); | 9 InspectorTest.sendCommandOrDie("DOM.enable", {}); |
| 10 InspectorTest.sendCommandOrDie("CSS.enable", {}); | 10 InspectorTest.sendCommandOrDie("CSS.enable", {}); |
| 11 | 11 |
| 12 var setMediaText; | 12 var setMediaText; |
| 13 var verifyProtocolError; | 13 var verifydpError; |
| 14 var dumpStyleSheet; | 14 var dumpStyleSheet; |
| 15 | 15 |
| 16 var firstMediaRange = { | 16 var firstMediaRange = { |
| 17 startLine: 0, | 17 startLine: 0, |
| 18 startColumn: 7, | 18 startColumn: 7, |
| 19 endLine: 0, | 19 endLine: 0, |
| 20 endColumn: 67 | 20 endColumn: 67 |
| 21 }; | 21 }; |
| 22 var secondMediaRange = { | 22 var secondMediaRange = { |
| 23 startLine: 6, | 23 startLine: 6, |
| 24 startColumn: 8, | 24 startColumn: 8, |
| 25 endLine: 8, | 25 endLine: 8, |
| 26 endColumn: 23 | 26 endColumn: 23 |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 function styleSheetAdded(result) | 29 function styleSheetAdded(result) |
| 30 { | 30 { |
| 31 var styleSheetId = result.params.header.styleSheetId; | 31 var styleSheetId = result.params.header.styleSheetId; |
| 32 setMediaText = InspectorTest.setMediaText.bind(InspectorTest, styleSheet
Id, false); | 32 setMediaText = InspectorTest.setMediaText.bind(InspectorTest, styleSheet
Id, false); |
| 33 verifyProtocolError = InspectorTest.setMediaText.bind(InspectorTest, sty
leSheetId, true); | 33 verifydpError = InspectorTest.setMediaText.bind(InspectorTest, styleShee
tId, true); |
| 34 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI
d); | 34 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI
d); |
| 35 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
styleSheetId }, onInitialStyleSheetText); | 35 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId:
styleSheetId }, onInitialStyleSheetText); |
| 36 } | 36 } |
| 37 | 37 |
| 38 function onInitialStyleSheetText(result) | 38 function onInitialStyleSheetText(result) |
| 39 { | 39 { |
| 40 InspectorTest.log("==== Initial style sheet text ===="); | 40 InspectorTest.log("==== Initial style sheet text ===="); |
| 41 InspectorTest.log(result.text); | 41 InspectorTest.log(result.text); |
| 42 InspectorTest.runTestSuite(testSuite); | 42 InspectorTest.runTestSuite(testSuite); |
| 43 } | 43 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 62 function testSimpleToComplexEdit(next) | 62 function testSimpleToComplexEdit(next) |
| 63 { | 63 { |
| 64 setMediaText({ | 64 setMediaText({ |
| 65 range: firstMediaRange, | 65 range: firstMediaRange, |
| 66 text: "all and (min-height: 20px), (max-width: 10px), handheld a
nd (min-monochrome: 8)" | 66 text: "all and (min-height: 20px), (max-width: 10px), handheld a
nd (min-monochrome: 8)" |
| 67 }, InspectorTest.undoAndNext(next)); | 67 }, InspectorTest.undoAndNext(next)); |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 function testInvalidParameters(next) | 70 function testInvalidParameters(next) |
| 71 { | 71 { |
| 72 verifyProtocolError({ | 72 verifydpError({ |
| 73 range: { startLine: "three", startColumn: 0, endLine: 4, endColu
mn: 0 }, | 73 range: { startLine: "three", startColumn: 0, endLine: 4, endColu
mn: 0 }, |
| 74 text: "no matter what is here" | 74 text: "no matter what is here" |
| 75 }, next); | 75 }, next); |
| 76 }, | 76 }, |
| 77 | 77 |
| 78 function testInvalidText(next) | 78 function testInvalidText(next) |
| 79 { | 79 { |
| 80 verifyProtocolError({ | 80 verifydpError({ |
| 81 range: firstMediaRange, | 81 range: firstMediaRange, |
| 82 text: "something /* is wrong here" | 82 text: "something /* is wrong here" |
| 83 }, next); | 83 }, next); |
| 84 }, | 84 }, |
| 85 | 85 |
| 86 function testInvalidText2(next) | 86 function testInvalidText2(next) |
| 87 { | 87 { |
| 88 verifyProtocolError({ | 88 verifydpError({ |
| 89 range: firstMediaRange, | 89 range: firstMediaRange, |
| 90 text: "something { is { wrong: here} }" | 90 text: "something { is { wrong: here} }" |
| 91 }, next); | 91 }, next); |
| 92 }, | 92 }, |
| 93 | 93 |
| 94 function testInvalidText3(next) | 94 function testInvalidText3(next) |
| 95 { | 95 { |
| 96 verifyProtocolError({ | 96 verifydpError({ |
| 97 range: firstMediaRange, | 97 range: firstMediaRange, |
| 98 text: "something { wrong" | 98 text: "something { wrong" |
| 99 }, next); | 99 }, next); |
| 100 }, | 100 }, |
| 101 | 101 |
| 102 function testEditSequentially(next) | 102 function testEditSequentially(next) |
| 103 { | 103 { |
| 104 var newText = "screen"; | 104 var newText = "screen"; |
| 105 var oldLength = firstMediaRange.endColumn - firstMediaRange.startCol
umn; | 105 var oldLength = firstMediaRange.endColumn - firstMediaRange.startCol
umn; |
| 106 var lengthDelta = newText.length - oldLength; | 106 var lengthDelta = newText.length - oldLength; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 133 } | 133 } |
| 134 ]; | 134 ]; |
| 135 } | 135 } |
| 136 | 136 |
| 137 </script> | 137 </script> |
| 138 <link rel="stylesheet" href="resources/set-media-text.css"/> | 138 <link rel="stylesheet" href="resources/set-media-text.css"/> |
| 139 </head> | 139 </head> |
| 140 <body onload="runTest();"> | 140 <body onload="runTest();"> |
| 141 </body> | 141 </body> |
| 142 </html> | 142 </html> |
| OLD | NEW |