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

Side by Side Diff: LayoutTests/inspector/elements/styles/add-new-rule-inline-style-csp.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 <meta http-equiv="Content-Security-Policy" content="style-src https://*:443 'uns afe-eval'">
4 <script src="../../../http/tests/inspector/inspector-test.js"></script>
5 <script src="../../../http/tests/inspector/elements-test.js"></script>
6 <script>
7
8 function test()
9 {
10 var nodeId;
11 var rule;
12
13
14 InspectorTest.runTestSuite([
15 function testSetUp(next) {
16 InspectorTest.selectNodeAndWaitForStyles("inspected", next);
17 },
18
19 function testAddRule(next)
20 {
21 InspectorTest.nodeWithId("inspected", nodeCallback);
22
23 function nodeCallback(node)
24 {
25 nodeId = node.id;
26 InspectorTest.addNewRule("#inspected", successCallback);
27 }
28
29 function successCallback(section)
30 {
31 rule = section.styleRule.rule();
32 InspectorTest.addResult("=== Rule added ===");
33 InspectorTest.addResult(rule.selectorText + " {" + rule.style.cs sText + "}");
34 InspectorTest.addResult("Selectors matching the (#inspected) nod e: " + InspectorTest.matchingSelectors(rule));
35 next();
36 }
37 },
38
39 function testAddProperty(next)
40 {
41 rule.style.appendProperty("width", "100%", callback);
42
43 function callback(newStyle)
44 {
45 InspectorTest.addResult("=== Added rule modified ===");
46 if (!newStyle) {
47 InspectorTest.addResult("[!] No valid rule style received");
48 InspectorTest.completeTest();
49 } else {
50 dumpProperties(newStyle);
51 InspectorTest.cssModel.setRuleSelector(rule, nodeId, "body", successCallback, failureCallback);
52 }
53 }
54
55 function successCallback(rule)
56 {
57 var doesAffectSelectedNode = rule.matchingSelectors.length > 0;
58 InspectorTest.addResult("=== Selector changed ===");
59 InspectorTest.addResult(rule.selectorText + " {" + rule.style.cs sText + "}");
60 InspectorTest.addResult("Selectors matching the (#inspected) nod e: " + InspectorTest.matchingSelectors(rule));
61
62 next();
63 }
64
65 function failureCallback()
66 {
67 InspectorTest.addResult("[!] Failed to change selector");
68 InspectorTest.completeTest();
69 }
70 },
71
72 function testModifyInlineStyle(next)
73 {
74 InspectorTest.cssModel.getInlineStylesAsync(nodeId, stylesCallback);
75
76 function stylesCallback(inlineStyle)
77 {
78 if (!inlineStyle) {
79 InspectorTest.completeTest();
80 return;
81 }
82 inlineStyle.appendProperty("font-size", "14px", appendCallback);
83 }
84
85 function appendCallback(newStyle)
86 {
87 InspectorTest.addResult("=== Inline style modified ===");
88 if (!newStyle) {
89 InspectorTest.addResult("No valid inline style received");
90 InspectorTest.completeTest();
91 return;
92 }
93
94 dumpProperties(newStyle);
95 next();
96 }
97 }
98 ]);
99
100 function dumpProperties(style)
101 {
102 if (!style)
103 return;
104 var allProperties = style.allProperties;
105 for (var i = 0; i < allProperties.length; ++i)
106 InspectorTest.addResult(allProperties[i].text);
107 }
108 }
109 </script>
110 </head>
111
112 <body onload="runTest()">
113 <p>
114 Tests that adding a new rule does not crash the renderer and modifying an inline style does not report errors when forbidden by Content-Security-Policy.
115 </p>
116
117 <div id="inspected">Text</div>
118
119 </body>
120 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698