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

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

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp Created 3 years, 6 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
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/resource s/inspector-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="../resources/css-protocol-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="../resources/dom-protocol-test.js"></script>
7 <script type="text/javascript"> 7 <script type="text/javascript">
8 function test() 8 function test()
9 { 9 {
10 var styleSheetId; 10 var styleSheetId;
11 var documentNodeId; 11 var documentNodeId;
12 var setStyleTexts; 12 var setStyleTexts;
13 var verifyProtocolError; 13 var verifydpError;
14 14
15 InspectorTest.sendCommandOrDie("DOM.enable", {}); 15 InspectorTest.sendCommandOrDie("DOM.enable", {});
16 InspectorTest.sendCommandOrDie("CSS.enable", {}, cssWasEnabled); 16 InspectorTest.sendCommandOrDie("CSS.enable", {}, cssWasEnabled);
17 17
18 function cssWasEnabled() 18 function cssWasEnabled()
19 { 19 {
20 InspectorTest.sendCommandOrDie("DOM.getDocument", {}, onGotDocument); 20 InspectorTest.sendCommandOrDie("DOM.getDocument", {}, onGotDocument);
21 } 21 }
22 22
23 function onGotDocument(result) 23 function onGotDocument(result)
24 { 24 {
25 documentNodeId = result.root.nodeId; 25 documentNodeId = result.root.nodeId;
26 InspectorTest.sendCommandOrDie("DOM.querySelector", { nodeId: documentNo deId, selector: "#inliner" }, onGotNode); 26 InspectorTest.sendCommandOrDie("DOM.querySelector", { nodeId: documentNo deId, selector: "#inliner" }, onGotNode);
27 } 27 }
28 28
29 function onGotNode(node) 29 function onGotNode(node)
30 { 30 {
31 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { nodeId: n ode.nodeId }, onGotInlineStyles); 31 InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", { nodeId: n ode.nodeId }, onGotInlineStyles);
32 } 32 }
33 33
34 function onGotInlineStyles(result) 34 function onGotInlineStyles(result)
35 { 35 {
36 styleSheetId = result.inlineStyle.styleSheetId; 36 styleSheetId = result.inlineStyle.styleSheetId;
37 setStyleTexts = InspectorTest.setStyleTexts.bind(InspectorTest, styleShe etId, false); 37 setStyleTexts = InspectorTest.setStyleTexts.bind(InspectorTest, styleShe etId, false);
38 verifyProtocolError = InspectorTest.setStyleTexts.bind(InspectorTest, st yleSheetId, true); 38 verifydpError = InspectorTest.setStyleTexts.bind(InspectorTest, styleShe etId, true);
39 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText); 39 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
40 } 40 }
41 41
42 function dumpAndNext(next) 42 function dumpAndNext(next)
43 { 43 {
44 return function() 44 return function()
45 { 45 {
46 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheet Id: styleSheetId }, onReceiveStyleSheetText); 46 InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheet Id: styleSheetId }, onReceiveStyleSheetText);
47 47
48 function onReceiveStyleSheetText(result) 48 function onReceiveStyleSheetText(result)
(...skipping 16 matching lines...) Expand all
65 { 65 {
66 setStyleTexts([{ 66 setStyleTexts([{
67 styleSheetId: styleSheetId, 67 styleSheetId: styleSheetId,
68 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 }, 68 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
69 text: "content: 'EDITED'", 69 text: "content: 'EDITED'",
70 }], dumpAndNext(next)); 70 }], dumpAndNext(next));
71 }, 71 },
72 72
73 function testSetStylePoorContent(next) 73 function testSetStylePoorContent(next)
74 { 74 {
75 verifyProtocolError([{ 75 verifydpError([{
76 styleSheetId: styleSheetId, 76 styleSheetId: styleSheetId,
77 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 }, 77 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
78 text: "}", 78 text: "}",
79 }], dumpAndNext(next)); 79 }], dumpAndNext(next));
80 }, 80 },
81 81
82 function testDeleteStyleBody(next) 82 function testDeleteStyleBody(next)
83 { 83 {
84 setStyleTexts([{ 84 setStyleTexts([{
85 styleSheetId: styleSheetId, 85 styleSheetId: styleSheetId,
86 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 }, 86 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
87 text: "", 87 text: "",
88 }], dumpAndNext(next)); 88 }], dumpAndNext(next));
89 }, 89 },
90 90
91 function testSetStyleOpenComment(next) 91 function testSetStyleOpenComment(next)
92 { 92 {
93 verifyProtocolError([{ 93 verifydpError([{
94 styleSheetId: styleSheetId, 94 styleSheetId: styleSheetId,
95 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 }, 95 range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 11 },
96 text: "/*", 96 text: "/*",
97 }], dumpAndNext(next)); 97 }], dumpAndNext(next));
98 } 98 }
99 ]; 99 ];
100 } 100 }
101 101
102 </script> 102 </script>
103 </head> 103 </head>
104 <body onload="runTest();"> 104 <body onload="runTest();">
105 <p>The test verifies functionality of protocol method CSS.setStyleTexts for inli ne elements.</p> 105 <p>The test verifies functionality of protocol method CSS.setStyleTexts for inli ne elements.</p>
106 <div id="inliner" style="color: red;"> 106 <div id="inliner" style="color: red;">
107 </body> 107 </body>
108 </html> 108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698