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

Side by Side Diff: LayoutTests/inspector/elements/styles/styles-history.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-history.css">
5
6 <script src="../../../http/tests/inspector/inspector-test.js"></script>
7 <script src="../../../http/tests/inspector/elements-test.js"></script>
8 <script src="../../../http/tests/inspector/resources-test.js"></script>
9 <script src="styles-test.js"></script>
10 <script>
11
12 function test()
13 {
14 InspectorTest.runAfterCachedResourcesProcessed(runTestSuite);
15
16 var uiSourceCode;
17
18 function runTestSuite()
19 {
20 InspectorTest.runTestSuite([
21 function testSetUp(next)
22 {
23 function visitUISourceCodes(currentUISourceCode)
24 {
25 if (currentUISourceCode.originURL().indexOf("styles-history. css") === -1)
26 return;
27 uiSourceCode = currentUISourceCode;
28 next();
29 }
30 WebInspector.workspace.uiSourceCodes().forEach(visitUISourceCode s);
31 },
32
33 function testSetResourceContentMinor(next)
34 {
35 InspectorTest.addSniffer(WebInspector.StyleFile.prototype, "_sty leContentSet", styleUpdatedMinor);
36 uiSourceCode.setWorkingCopy("body {\n margin: 15px;\n padding: 10px;\n}");
37
38 function styleUpdatedMinor()
39 {
40 dumpHistory(next)();
41 }
42 },
43
44 function testSetResourceContentMajor(next)
45 {
46 InspectorTest.addSniffer(WebInspector.StyleFile.prototype, "_sty leContentSet", styleUpdatedMinor);
47 uiSourceCode.setWorkingCopy("body {\n margin: 20px;\n padding: 10px;\n}");
48
49 function styleUpdatedMinor()
50 {
51 InspectorTest.addSniffer(WebInspector.StyleFile.prototype, " _styleContentSet", styleUpdatedMajor);
52 uiSourceCode.commitWorkingCopy(function() { });
53
54 function styleUpdatedMajor()
55 {
56 dumpHistory(next)();
57 }
58 }
59 },
60
61 function testSetContentViaModelMinor(next)
62 {
63 styleSheetForResource(step1);
64
65 function step1(style)
66 {
67 var property = style.getLiveProperty("margin");
68 property.setText("margin:25px;", false, true, dumpHistory(ne xt));
69 }
70 },
71
72 function testSetContentViaModelMajor(next)
73 {
74 styleSheetForResource(step1);
75
76 function step1(style)
77 {
78 var property = style.getLiveProperty("margin");
79 property.setText("margin:30px;", true, true);
80 InspectorTest.runAfterPendingDispatches(dumpHistory(next));
81 }
82 }
83 ]);
84 }
85
86 function styleSheetForResource(callback)
87 {
88 InspectorTest.nodeWithId("mainBody", onNodeSelected);
89
90 function onNodeSelected(node)
91 {
92 InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, true, true, onMatchedStylesForNode);
93 }
94
95 function onMatchedStylesForNode(error, matchedStyles)
96 {
97 if (error) {
98 InspectorTest.addResult("error: " + error);
99 InspectorTest.completeTest();
100 return;
101 }
102 for (var i = 0; i < matchedStyles.length; ++i) {
103 var rule = matchedStyles[i].rule;
104 if (rule.origin !== "regular")
105 continue;
106 callback(WebInspector.CSSStyleDeclaration.parsePayload(Inspector Test.cssModel, rule.style));
107 return;
108 }
109 InspectorTest.addResult("error: did not find any regular rule");
110 InspectorTest.completeTest();
111 }
112 }
113
114 function dumpHistory(next)
115 {
116 function result()
117 {
118 InspectorTest.addResult("History length: " + uiSourceCode.history.le ngth);
119 for (var i = 0; i < uiSourceCode.history.length; ++i) {
120 InspectorTest.addResult("Item " + i + ":");
121 InspectorTest.addResult(uiSourceCode.history[i].content);
122 }
123 next();
124 }
125 return result;
126 }
127 }
128
129 </script>
130 </head>
131
132 <body id="mainBody" onload="runTest()">
133 <p>
134 Tests resources panel history.
135 </p>
136 </body>
137 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698