OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 | 3 |
4 <link rel="stylesheet" href="resources/styles-new-API.css"> | 4 <link rel="stylesheet" href="resources/styles-new-API.css"> |
5 | 5 |
6 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 6 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
7 <script src="../../../http/tests/inspector/elements-test.js"></script> | 7 <script src="../../../http/tests/inspector/elements-test.js"></script> |
8 <script src="../styles/styles-test.js"></script> | 8 <script src="../styles/styles-test.js"></script> |
9 <script> | 9 <script> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 function computedCallback(error, computedStyle) | 51 function computedCallback(error, computedStyle) |
52 { | 52 { |
53 if (error) { | 53 if (error) { |
54 InspectorTest.addResult("error: " + error); | 54 InspectorTest.addResult("error: " + error); |
55 InspectorTest.completeTest(); | 55 InspectorTest.completeTest(); |
56 return; | 56 return; |
57 } | 57 } |
58 resultStyles.computedStyle = computedStyle; | 58 resultStyles.computedStyle = computedStyle; |
59 } | 59 } |
60 | 60 |
61 function inlineCallback(error, inlineStyle) | 61 function matchedCallback(error, inlineStyle, attributeStyle, matched
CSSRules, pseudoElements, inherited) |
62 { | 62 { |
63 if (error) { | 63 if (error) { |
64 InspectorTest.addResult("error: " + error); | 64 InspectorTest.addResult("error: " + error); |
65 InspectorTest.completeTest(); | |
66 return; | |
67 } | |
68 resultStyles.inlineStyle = inlineStyle; | |
69 } | |
70 | |
71 function matchedCallback(error, matchedCSSRules, pseudoElements, inh
erited) | |
72 { | |
73 if (error) { | |
74 InspectorTest.addResult("error: " + error); | |
75 InspectorTest.completeTest(); | 65 InspectorTest.completeTest(); |
76 return; | 66 return; |
77 } | 67 } |
78 | 68 |
| 69 resultStyles.inlineStyle = inlineStyle; |
79 resultStyles.matchedCSSRules = matchedCSSRules; | 70 resultStyles.matchedCSSRules = matchedCSSRules; |
80 resultStyles.pseudoElements = pseudoElements; | 71 resultStyles.pseudoElements = pseudoElements; |
81 resultStyles.inherited = inherited; | 72 resultStyles.inherited = inherited; |
82 } | 73 } |
83 | 74 |
84 function nodeCallback(node) | 75 function nodeCallback(node) |
85 { | 76 { |
86 bodyId = node.id; | 77 bodyId = node.id; |
87 var promises = [ | 78 var promises = [ |
88 InspectorTest.CSSAgent.getComputedStyleForNode(node.id, comp
utedCallback), | 79 InspectorTest.CSSAgent.getComputedStyleForNode(node.id, comp
utedCallback), |
89 InspectorTest.CSSAgent.getInlineStylesForNode(node.id, inlin
eCallback), | |
90 InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, matc
hedCallback) | 80 InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, matc
hedCallback) |
91 ]; | 81 ]; |
92 Promise.all(promises).then(callback.bind(null, resultStyles)); | 82 Promise.all(promises).then(callback.bind(null, resultStyles)); |
93 } | 83 } |
94 InspectorTest.selectNodeWithId("mainBody", nodeCallback); | 84 InspectorTest.selectNodeWithId("mainBody", nodeCallback); |
95 }, | 85 }, |
96 | 86 |
97 function test_forcedState(next) | 87 function test_forcedState(next) |
98 { | 88 { |
99 InspectorTest.CSSAgent.forcePseudoState(bodyId, ["hover"]); | 89 InspectorTest.CSSAgent.forcePseudoState(bodyId, ["hover"]); |
100 InspectorTest.CSSAgent.getMatchedStylesForNode(bodyId, matchedCallba
ck); | 90 InspectorTest.CSSAgent.getMatchedStylesForNode(bodyId, matchedCallba
ck); |
101 | 91 |
102 function matchedCallback(error, matchedRules) | 92 function matchedCallback(error, inlineStyle, attributeStyle, matched
Rules) |
103 { | 93 { |
104 InspectorTest.addResult("=== BODY with forced :hover ==="); | 94 InspectorTest.addResult("=== BODY with forced :hover ==="); |
105 InspectorTest.dumpRuleMatchesArray(matchedRules); | 95 InspectorTest.dumpRuleMatchesArray(matchedRules); |
106 InspectorTest.CSSAgent.forcePseudoState(bodyId, ["hover"], next)
; | 96 InspectorTest.CSSAgent.forcePseudoState(bodyId, ["hover"], next)
; |
107 } | 97 } |
108 }, | 98 }, |
109 | 99 |
110 function test_textNodeComputedStyles(next) | 100 function test_textNodeComputedStyles(next) |
111 { | 101 { |
112 function callback(error, computedStyle) | 102 function callback(error, computedStyle) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 157 |
168 function nodeCallback(node) | 158 function nodeCallback(node) |
169 { | 159 { |
170 InspectorTest.CSSAgent.getInlineStylesForNode(node.id, callback)
; | 160 InspectorTest.CSSAgent.getInlineStylesForNode(node.id, callback)
; |
171 } | 161 } |
172 InspectorTest.nodeWithId("thetable", nodeCallback); | 162 InspectorTest.nodeWithId("thetable", nodeCallback); |
173 }, | 163 }, |
174 | 164 |
175 function test_addRule(next) | 165 function test_addRule(next) |
176 { | 166 { |
177 function didGetStyles(error, matchedCSSRules) | 167 function didGetStyles(error, inlineStyle, attributeStyle, matchedCSS
Rules) |
178 { | 168 { |
179 if (error) { | 169 if (error) { |
180 InspectorTest.addResult("error: " + error); | 170 InspectorTest.addResult("error: " + error); |
181 return; | 171 return; |
182 } | 172 } |
183 InspectorTest.addResult(""); | 173 InspectorTest.addResult(""); |
184 InspectorTest.addResult("=== Matched rules after rule added ==="
); | 174 InspectorTest.addResult("=== Matched rules after rule added ==="
); |
185 InspectorTest.dumpRuleMatchesArray(matchedCSSRules); | 175 InspectorTest.dumpRuleMatchesArray(matchedCSSRules); |
186 next(); | 176 next(); |
187 } | 177 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 267 |
278 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-
weight: normal; width: 85%; background-image: url(bar.png)"> | 268 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-
weight: normal; width: 85%; background-image: url(bar.png)"> |
279 <p> | 269 <p> |
280 Tests that InspectorCSSAgent API methods work as expected. | 270 Tests that InspectorCSSAgent API methods work as expected. |
281 </p> | 271 </p> |
282 <table width="50%" id="thetable"> | 272 <table width="50%" id="thetable"> |
283 </table> | 273 </table> |
284 <h1 id="toggle">H1</h1> | 274 <h1 id="toggle">H1</h1> |
285 </body> | 275 </body> |
286 </html> | 276 </html> |
OLD | NEW |