| Index: third_party/WebKit/LayoutTests/inspector-protocol/css/css-set-multiple-style-texts.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/css/css-set-multiple-style-texts.html b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-set-multiple-style-texts.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..78cec5847098df4ce54a0f5b2c10b63199fd3f55
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-set-multiple-style-texts.html
|
| @@ -0,0 +1,177 @@
|
| +<html>
|
| +<head>
|
| +<link rel="stylesheet" href="resources/set-style-text.css"/>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/css-protocol-test.js"></script>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
|
| +<script type="text/javascript">
|
| +
|
| +function test()
|
| +{
|
| + var setStyleTexts;
|
| + var verifyProtocolError;
|
| + var styleSheetId;
|
| + var undoAndNext = InspectorTest.undoAndNext;
|
| +
|
| + InspectorTest.requestDocumentNodeId(onDocumentNodeId);
|
| +
|
| + function onDocumentNodeId(nodeId)
|
| + {
|
| + InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
|
| + InspectorTest.sendCommandOrDie("CSS.enable", {});
|
| + }
|
| +
|
| + function styleSheetAdded(result)
|
| + {
|
| + styleSheetId = result.params.header.styleSheetId;
|
| + setStyleTexts = InspectorTest.setStyleTexts.bind(InspectorTest, styleSheetId, false);
|
| + verifyProtocolError = InspectorTest.setStyleTexts.bind(InspectorTest, styleSheetId, true);
|
| + InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
|
| + }
|
| +
|
| + function onInitialStyleSheetText(result)
|
| + {
|
| + InspectorTest.log("==== Initial style sheet text ====");
|
| + InspectorTest.log(result.text);
|
| + InspectorTest.runTestSuite(testSuite);
|
| + }
|
| +
|
| + var testSuite = [
|
| + function testMalformedArguments1(next)
|
| + {
|
| + verifyProtocolError([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + {
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + ], next);
|
| + },
|
| +
|
| + function testMalformedArguments2(next)
|
| + {
|
| + verifyProtocolError([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + {
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + ], next);
|
| + },
|
| +
|
| + function testMalformedArguments3(next)
|
| + {
|
| + verifyProtocolError([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: "STRING INSTEAD OF NUMBER", startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + ], next);
|
| + },
|
| +
|
| + function testFirstEditDoesNotApply(next)
|
| + {
|
| + verifyProtocolError([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED';/*\n",
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + ], next);
|
| + },
|
| +
|
| + function testSecondEditDoesNotApply(next)
|
| + {
|
| + verifyProtocolError([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED';\n",
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED';/*\n",
|
| + },
|
| + ], next);
|
| + },
|
| +
|
| + function testBasicSetStyle(next)
|
| + {
|
| + setStyleTexts([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED';\n"
|
| + },
|
| + ], undoAndNext(next));
|
| + },
|
| +
|
| + function testMultipleStyleTexts1(next)
|
| + {
|
| + setStyleTexts([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED1';\n",
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED2';\n",
|
| + },
|
| + ], undoAndNext(next));
|
| + },
|
| +
|
| + function testMultipleStyleTexts2(next)
|
| + {
|
| + setStyleTexts([
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 17, startColumn: 11, endLine: 18, endColumn: 4 },
|
| + text: "\n content: 'EDITED5';\n",
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
|
| + text: "\n content: 'EDITED4';\n",
|
| + },
|
| + {
|
| + styleSheetId: styleSheetId,
|
| + range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
|
| + text: "\n content: 'EDITED3';\n",
|
| + },
|
| + ], undoAndNext(next));
|
| + },
|
| + ];
|
| +}
|
| +
|
| +</script>
|
| +</head>
|
| +<body onload="runTest();">
|
| +<p>The test verifies functionality of protocol method CSS.setStyleTexts.</p>
|
| +<article id="test"></article>
|
| +</body>
|
| +</html>
|
|
|