Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/css/css-set-multiple-style-texts.html

Issue 1694433003: DevTools: [CSS] Add CSS.setMultipleStyleTexts command to CSS domain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: %zu is not cross-platform - do not use. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698