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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/style-src/style-src-injected-inline-style-blocked.html

Issue 2784543003: Fixed wpt content-security-policy/style-src tests (Closed)
Patch Set: CR changes Created 3 years, 8 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
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsaf e-inline'; style-src 'self'">
5 <script src='/resources/testharness.js'></script>
6 <script src='/resources/testharnessreport.js'></script>
7
8 <script>
9 var t = async_test("Injected style attributes should not be applied");
10 var t_spv = async_test("Should fire a securitypolicyviolation event");
11
12 document.addEventListener("securitypolicyviolation", t_spv.step_func_done( function(e) {
13 assert_equals("style-src", e.violatedDirective);
14 }));
15 </script>
16 </head>
17 <body>
18 <div id='log'></div>
19
20 <div id="content">Lorem ipsum</div>
21
22 <script src='/content-security-policy/style-src/resources/style-src-inject-s tyle.js'></script>
23
24 <script>
25 onload = t.step_func_done(function(e) {
26 var contentEl = document.getElementById("content");
27
28 // the 'style-src-inject-style.js' script attempts to set attributes in two ways,
29 // once the left and once the right margin
30 // this is why in this test we check both to make sure neither way worke d
31
32 var marginLeftVal = getComputedStyle(contentEl).getPropertyValue('margin -left');
33 assert_false(marginLeftVal == "2px");
34 var marginRightVal = getComputedStyle(contentEl).getPropertyValue('margi n-right');
35 assert_false(marginRightVal == "2px");
36 });
37 </script>
38
39 </body>
40 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698