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

Side by Side Diff: LayoutTests/inspector/elements/styles/styles-source-offsets.html

Issue 1158883003: DevTools: shard inspector/elements tests for faster execution. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3
4 <link rel="stylesheet" href="resources/styles-source-offsets.css">
5
6 <script src="../../../http/tests/inspector/inspector-test.js"></script>
7 <script src="../../../http/tests/inspector/elements-test.js"></script>
8 <script>
9
10 function test()
11 {
12 function dumpStyleData(ruleOrStyle)
13 {
14 var isRule = !!(ruleOrStyle.style);
15 var style;
16 var header = "";
17 if (isRule) {
18 if (ruleOrStyle.origin !== "regular")
19 return;
20 style = ruleOrStyle.style;
21 var selectorRanges = [];
22 var selectors = ruleOrStyle.selectorList.selectors;
23 var firstRange = selectors[0].range;
24 var lastRange = selectors[selectors.length - 1].range;
25 var range = { startLine: firstRange.startLine, startColumn: firstRan ge.startColumn, endLine: lastRange.endLine, endColumn: lastRange.endColumn };
26 header = ruleOrStyle.selectorList.text + ": " + (range ? InspectorTe st.rangeText(range) : "");
27 } else {
28 style = ruleOrStyle;
29 header = "element.style:";
30 }
31 InspectorTest.addResult(header + " " + InspectorTest.rangeText(style.ran ge));
32 var allProperties = style.cssProperties;
33 for (var i = 0; i < allProperties.length; ++i) {
34 var property = allProperties[i];
35 if (!property.range)
36 continue;
37 InspectorTest.addResult("['" + property.name + "':'" + property.valu e + "'" + (property.important ? " !important" : "") + (("parsedOk" in property) ? " non-parsed" : "") +"] @" + InspectorTest.rangeText(property.range));
38 }
39 }
40
41 InspectorTest.selectNodeWithId("mainBody", step1);
42
43 var resultStyles = {};
44
45 function inlineCallback(error, inlineStyle)
46 {
47 if (error) {
48 InspectorTest.addResult("error: " + error);
49 InspectorTest.completeTest();
50 return;
51 }
52
53 resultStyles.inlineStyle = inlineStyle;
54 }
55
56 function matchedCallback(error, matchedCSSRules)
57 {
58 if (error) {
59 InspectorTest.addResult("error: " + error);
60 InspectorTest.completeTest();
61 return;
62 }
63 resultStyles.matchedCSSRules = matchedCSSRules;
64 step2();
65 }
66
67 function step1(node)
68 {
69 InspectorTest.CSSAgent.getInlineStylesForNode(node.id, inlineCallback);
70 InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, matchedCallback) ;
71 }
72
73 function step2()
74 {
75 var matchedCSSRules = resultStyles.matchedCSSRules;
76 for (var i = 0; i < matchedCSSRules.length; ++i)
77 dumpStyleData(matchedCSSRules[i].rule);
78 dumpStyleData(resultStyles.inlineStyle);
79 InspectorTest.completeTest();
80 }
81 }
82
83 </script>
84
85 <style>
86
87 body.mainpage {
88 text-decoration: none; /* at least one valid property is necessary for WebCo re to match a rule */
89 badproperty: 1badvalue1;
90 }
91
92 </style>
93 </head>
94
95 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font- weight: normal; width: 80%">
96 <p>
97 Tests that proper data and start/end offset positions are reported for CSS style declarations and properties.
98 </p>
99
100 </body>
101 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698