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

Side by Side Diff: LayoutTests/inspector/elements/styles/undo-add-new-rule.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 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
5 <script>
6
7 function test()
8 {
9 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
10
11 var treeElement;
12
13 function step1()
14 {
15 addNewRuleAndSelectNode("other", step2);
16 }
17
18 function step2()
19 {
20 addNewRuleAndSelectNode("inspected", step3);
21 }
22
23 function step3()
24 {
25 InspectorTest.addResult("After adding new rule:");
26 InspectorTest.dumpSelectedElementStyles(true, false, true);
27 printStyleSheetAndCall(step4);
28 }
29
30 function step4()
31 {
32 InspectorTest.domModel.undo();
33 InspectorTest.selectNodeAndWaitForStyles("other", step5);
34 }
35
36 function step5()
37 {
38 InspectorTest.addResult("After undo:");
39 InspectorTest.dumpSelectedElementStyles(true, false, true);
40 printStyleSheetAndCall(step6);
41 }
42
43 function step6()
44 {
45 InspectorTest.domModel.redo();
46 InspectorTest.selectNodeAndWaitForStyles("inspected", step7);
47 }
48
49 function step7()
50 {
51 InspectorTest.addResult("After redo:");
52 InspectorTest.dumpSelectedElementStyles(true, false, true);
53 printStyleSheetAndCall(step8);
54 }
55
56 function step8()
57 {
58 InspectorTest.completeTest();
59 }
60
61 function addNewRuleAndSelectNode(nodeId, next)
62 {
63 function selectNode()
64 {
65 InspectorTest.selectNodeAndWaitForStyles(nodeId, next);
66 }
67
68 InspectorTest.addNewRule("div.foo", selectNode);
69 }
70
71 function printStyleSheetAndCall(next)
72 {
73 var section = InspectorTest.firstMatchedStyleSection();
74 var id = section.styleRule.style().styleSheetId;
75 InspectorTest.CSSAgent.getStyleSheetText(id, callback);
76 function callback(result, styleSheetText)
77 {
78 InspectorTest.addResult("===== Style sheet text: =====");
79 InspectorTest.addResult(styleSheetText);
80 InspectorTest.addResult("=============================");
81 next();
82 }
83 }
84 }
85
86 </script>
87 </head>
88
89 <body onload="runTest()">
90 <p>
91 Tests that adding a new rule can be undone.
92 </p>
93
94 <div class="foo" id="inspected" style="font-size: 12px">Text</div>
95 <div class="foo" id="other" style="color:red"></div>
96
97 </body>
98 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698