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

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: rebaseline 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..353252b7c2a6e8e549f8840465658edb3e5bb931
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-set-multiple-style-texts.html
@@ -0,0 +1,194 @@
+<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 setStyleText;
+ var verifyProtocolError;
+ var dumpStyleSheet;
+ var documentNodeId;
+ var styleSheetId;
+ var undoAndNext = InspectorTest.undoAndNext;
+
+ InspectorTest.requestDocumentNodeId(onDocumentNodeId);
+
+ function onDocumentNodeId(nodeId)
+ {
+ documentNodeId = nodeId;
+ InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
+ InspectorTest.sendCommandOrDie("CSS.enable", {});
+ }
+
+ function styleSheetAdded(result)
+ {
+ styleSheetId = result.params.header.styleSheetId;
+ setStyleTexts = InspectorTest.setMultipleStyleTexts.bind(InspectorTest, styleSheetId, false);
+ verifyProtocolError = InspectorTest.setMultipleStyleTexts.bind(InspectorTest, styleSheetId, true);
+ dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetId);
+ 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({
+ styleSheetIds: [
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED';\n",
+ "\n content: 'EDITED';\n",
+ ],
+ }, next);
+ },
+
+ function testMalformedArguments2(next)
+ {
+ verifyProtocolError({
+ styleSheetIds: [
+ styleSheetId,
+ styleSheetId,
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED';\n",
+ "\n content: 'EDITED';\n",
+ ],
+ }, next);
+ },
+
+ function testMalformedArguments3(next)
+ {
+ verifyProtocolError({
+ styleSheetIds: [
+ styleSheetId,
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: "STRING INSTEAD OF NUMBER", startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED';\n",
+ "\n content: 'EDITED';\n",
+ ],
+ }, next);
+ },
+
+ function testFirstEditDoesNotApply(next)
+ {
+ verifyProtocolError({
+ styleSheetIds: [
+ styleSheetId,
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED2';/*\n",
+ "\n content: 'EDITED2';\n",
+ ],
+ }, next);
+ },
+
+ function testSecondEditDoesNotApply(next)
+ {
+ verifyProtocolError({
+ styleSheetIds: [
+ styleSheetId,
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED2';\n",
+ "\n content: 'EDITED2';/*\n",
+ ],
+ }, next);
+ },
+
+ function testBasicSetStyle(next)
+ {
+ setStyleTexts({
+ styleSheetIds: [ styleSheetId ],
+ ranges: [
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED';\n"
+ ],
+ }, undoAndNext(next));
+ },
+
+ function testMultipleStyleTexts1(next)
+ {
+ setStyleTexts({
+ styleSheetIds: [
+ styleSheetId,
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED1';\n",
+ "\n content: 'EDITED2';\n",
+ ],
+ }, undoAndNext(next));
+ },
+
+ function testMultipleStyleTexts2(next)
+ {
+ setStyleTexts({
+ styleSheetIds: [
+ styleSheetId,
+ styleSheetId,
+ styleSheetId
+ ],
+ ranges: [
+ { startLine: 17, startColumn: 11, endLine: 18, endColumn: 4 },
+ { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
+ { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
+ ],
+ texts: [
+ "\n content: 'EDITED5';\n",
+ "\n content: 'EDITED4';\n",
+ "\n content: 'EDITED3';\n",
+ ],
+ }, undoAndNext(next));
+ },
+ ];
+}
+
+</script>
+</head>
+<body onload="runTest();">
+<p>The test verifies functionality of protocol method CSS.setStyleText.</p>
+<article id="test"></article>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698