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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/css/cssom-modify-rule-and-get-rule-list.html

Issue 2484903002: DevTools: fix a crash in stopRuleUsageTracking (Closed)
Patch Set: stopRuleUsageTracking crash fixed Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/css/cssom-modify-rule-and-get-rule-list-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
(Empty)
1 <html>
2 <head>
3
4 <style>
5 #modifyRule {
6 box-sizing: border-box;
7 }
8
9 #modifyRule {
10 height: 100%;
11 }
12
13 #modifyRule {
14 width: 100%;
15 }
16 </style>
17
18 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
19 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot ocol-test.js"></script>
20 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot ocol-test.js"></script>
21 <script type="text/javascript">
22
23 function test()
24 {
25 var documentNodeId;
26
27 InspectorTest.requestDocumentNodeId(onDocumentNodeId);
28
29 function onDocumentNodeId(nodeId)
30 {
31 documentNodeId = nodeId;
32 InspectorTest.sendCommandOrDie("DOM.enable", {});
33 InspectorTest.sendCommandOrDie("CSS.enable", {}, function() {
34 InspectorTest.sendCommandOrDie("CSS.startRuleUsageTracking", {}, () =>
35 { InspectorTest.runTestSuite(testSuit e); })
36 });
37 }
38
39 var testSuite = [
40 function testModifyRule(next)
41 {
42 step1();
43
44 function step1()
45 {
46 InspectorTest.evaluateInPage("document.styleSheets[0].rules[0].s tyle.setProperty('color', 'red')");
caseq 2016/11/08 01:27:48 extract a function in the page called doActions()
47 step2();
48 }
49
50 function step2()
51 {
52 InspectorTest.evaluateInPage("document.styleSheets[0].rules[2].s tyle.setProperty('color', 'blue')");
53 step3();
54 }
55
56 function step3()
57 {
58 InspectorTest.evaluateInPage("document.styleSheets[0].rules[1].s tyle.setProperty('color', 'green')");
59
60 InspectorTest.sendCommandOrDie("CSS.stopRuleUsageTracking", {}, ruleListLoaded);
61 function ruleListLoaded(result) {
62 if(!result) {
63 next();
64 return;
65 }
66 var rules = result.ruleUsage;
67 var usedLines = rules.filter(rule => rule.used);
68 var unusedLines = rules.filter(rule => !rule.used);
69
70 usedLines.sort();
71 unusedLines.sort();
72 InspectorTest.log("=== Size of array: " + rules.length);
73 InspectorTest.log(" Number of used Rules: " + usedLines.le ngth);
74 for(var line of usedLines)
75 InspectorTest.log(line.range.startLine);
76
77 InspectorTest.log(" Number of unused Rules: " + unusedLine s.length);
78 for(var line of unusedLines)
79 InspectorTest.log(line.range.startLine);
80
81 next();
82 }
83 }
84 }
85 ];
86 }
87
88 </script>
89 </head>
90 <body onload="runTest();">
91 <p>The test verifies that CSS.stopRuleUsageTracking doesn't crash when used conc urrently with the CSSOM modifications.</p>
92 <article id="modifyRule"></article>
93 </body>
94 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/css/cssom-modify-rule-and-get-rule-list-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698