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

Side by Side Diff: LayoutTests/inspector-protocol/css/css-set-style-text.html

Issue 1219713003: DevTools: [regression] compare canonical text when matching styles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: awesome review comment addressed. Created 5 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css/css-set-style-text-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/inspecto r-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="../../http/tests/inspector-protocol/css-prot ocol-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="../../http/tests/inspector-protocol/dom-prot ocol-test.js"></script>
7 <script type="text/javascript"> 7 <script type="text/javascript">
8 8
9 function removeRule() 9 function removeRule()
10 { 10 {
(...skipping 19 matching lines...) Expand all
30 30
31 function styleSheetAdded(result) 31 function styleSheetAdded(result)
32 { 32 {
33 styleSheetId = result.params.header.styleSheetId; 33 styleSheetId = result.params.header.styleSheetId;
34 setStyleText = InspectorTest.setStyleText.bind(InspectorTest, styleSheet Id, false); 34 setStyleText = InspectorTest.setStyleText.bind(InspectorTest, styleSheet Id, false);
35 verifyProtocolError = InspectorTest.setStyleText.bind(InspectorTest, sty leSheetId, true); 35 verifyProtocolError = InspectorTest.setStyleText.bind(InspectorTest, sty leSheetId, true);
36 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d); 36 dumpStyleSheet = InspectorTest.dumpStyleSheetText.bind(null, styleSheetI d);
37 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText); 37 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
38 } 38 }
39 39
40 function dumpAndNext(next) 40 function dumpAndCall(next)
41 {
42 return InspectorTest.loadAndDumpMatchingRules.bind(InspectorTest, docume ntNodeId, "#test", next);
43 }
44
45 function dumpUndoAndNext(next)
41 { 46 {
42 return InspectorTest.loadAndDumpMatchingRules.bind(InspectorTest, docume ntNodeId, "#test", InspectorTest.undoAndNext(next)); 47 return InspectorTest.loadAndDumpMatchingRules.bind(InspectorTest, docume ntNodeId, "#test", InspectorTest.undoAndNext(next));
43 } 48 }
44 49
45 function onInitialStyleSheetText(result) 50 function onInitialStyleSheetText(result)
46 { 51 {
47 InspectorTest.log("==== Initial style sheet text ===="); 52 InspectorTest.log("==== Initial style sheet text ====");
48 InspectorTest.log(result.text); 53 InspectorTest.log(result.text);
49 InspectorTest.runTestSuite(testSuite); 54 InspectorTest.runTestSuite(testSuite);
50 } 55 }
51 56
52 var testSuite = [ 57 var testSuite = [
53 function testBasicSetStyle(next) 58 function testBasicSetStyle(next)
54 { 59 {
55 setStyleText({ 60 setStyleText({
56 styleSheetId: styleSheetId, 61 styleSheetId: styleSheetId,
57 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 }, 62 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
58 text: "\n content: 'EDITED';\n", 63 text: "\n content: 'EDITED';\n",
59 }, dumpAndNext(next)); 64 }, dumpUndoAndNext(next));
65 },
66
67 function testSetStyleTwice(next)
68 {
69 setStyleText({
70 styleSheetId: styleSheetId,
71 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
72 text: "\n color: green;\n padding: 0 4px;\n cursor: poi nter\n",
73 }, dumpAndCall(step2));
74
75 function step2()
76 {
77 setStyleText({
78 styleSheetId: styleSheetId,
79 range: { startLine: 0, startColumn: 7, endLine: 4, endColumn : 0 },
80 text: "\n color: green;\n padding: 0 6px;\n cursor: pointer\n",
81 }, dumpAndCall(step3));
82 }
83
84 function step3()
85 {
86 setStyleText({
87 styleSheetId: styleSheetId,
88 range: { startLine: 0, startColumn: 7, endLine: 4, endColumn : 0 },
89 text: "\n color: green;\n padding: 0 8px;\n cursor: pointer\n",
90 }, dumpUndoAndNext(next));
91 }
60 }, 92 },
61 93
62 function testSetStylePoorContent(next) 94 function testSetStylePoorContent(next)
63 { 95 {
64 verifyProtocolError({ 96 verifyProtocolError({
65 styleSheetId: styleSheetId, 97 styleSheetId: styleSheetId,
66 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 }, 98 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn: 0 },
67 text: "}", 99 text: "}",
68 }, dumpAndNext(next)); 100 }, dumpUndoAndNext(next));
69 }, 101 },
70 102
71 function testSetStyleInMedia(next) 103 function testSetStyleInMedia(next)
72 { 104 {
73 setStyleText({ 105 setStyleText({
74 styleSheetId: styleSheetId, 106 styleSheetId: styleSheetId,
75 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 }, 107 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
76 text: "\n content: 'EDITED';\n color: red;\n /** foo */\n ", 108 text: "\n content: 'EDITED';\n color: red;\n /** foo */\n ",
77 }, dumpAndNext(next)); 109 }, dumpUndoAndNext(next));
78 }, 110 },
79 111
80 function testDeleteStyleBody(next) 112 function testDeleteStyleBody(next)
81 { 113 {
82 setStyleText({ 114 setStyleText({
83 styleSheetId: styleSheetId, 115 styleSheetId: styleSheetId,
84 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 }, 116 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
85 text: "", 117 text: "",
86 }, dumpAndNext(next)); 118 }, dumpUndoAndNext(next));
87 }, 119 },
88 120
89 function testSetStylePoorRange(next) 121 function testSetStylePoorRange(next)
90 { 122 {
91 verifyProtocolError({ 123 verifyProtocolError({
92 styleSheetId: styleSheetId, 124 styleSheetId: styleSheetId,
93 range: { startLine: 11, startColumn: 11, endLine: 15, endColumn: 4 }, 125 range: { startLine: 11, startColumn: 11, endLine: 15, endColumn: 4 },
94 text: "\n content: 'EDITED';\n", 126 text: "\n content: 'EDITED';\n",
95 }, dumpAndNext(next)); 127 }, dumpUndoAndNext(next));
96 }, 128 },
97 129
98 function testSetStyleOpenComment(next) 130 function testSetStyleOpenComment(next)
99 { 131 {
100 verifyProtocolError({ 132 verifyProtocolError({
101 styleSheetId: styleSheetId, 133 styleSheetId: styleSheetId,
102 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 }, 134 range: { startLine: 13, startColumn: 11, endLine: 15, endColumn: 4 },
103 text: "\n content: 'EDITED'/* ;\n", 135 text: "\n content: 'EDITED'/* ;\n",
104 }, dumpAndNext(next)); 136 }, dumpUndoAndNext(next));
105 }, 137 },
106 138
107 function testSetStyleOfRemovedRule(next) 139 function testSetStyleOfRemovedRule(next)
108 { 140 {
109 InspectorTest.sendCommandOrDie("Runtime.evaluate", {expression: "rem oveRule()"}, mutateRule); 141 InspectorTest.sendCommandOrDie("Runtime.evaluate", {expression: "rem oveRule()"}, mutateRule);
110 function mutateRule() 142 function mutateRule()
111 { 143 {
112 setStyleText({ 144 setStyleText({
113 styleSheetId: styleSheetId, 145 styleSheetId: styleSheetId,
114 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn : 0 }, 146 range: { startLine: 0, startColumn: 7, endLine: 2, endColumn : 0 },
115 text: "\n content: 'EDITED';\n", 147 text: "\n content: 'EDITED';\n",
116 }, dumpAndNext(next)); 148 }, dumpUndoAndNext(next));
117 } 149 }
118 } 150 }
119 ]; 151 ];
120 } 152 }
121 153
122 </script> 154 </script>
123 </head> 155 </head>
124 <body onload="runTest();"> 156 <body onload="runTest();">
125 <p>The test verifies functionality of protocol method CSS.setStyleText.</p> 157 <p>The test verifies functionality of protocol method CSS.setStyleText.</p>
126 <article id="test"></article> 158 <article id="test"></article>
127 </body> 159 </body>
128 </html> 160 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css/css-set-style-text-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698