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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/blink-contrib-2/scriptnonce-allowed.sub.html

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 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
4 <head>
5 <!-- Programmatically converted from a WebKit Reftest, please forgive result ing idiosyncracies.-->
6 <title>scriptnonce-allowed</title>
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <script nonce="noncynonce">
10 function log(msg) {
11 test(function() {
12 assert_unreached(msg)
13 });
14 }
15
16 </script>
17 <script nonce="noncynonce">
18 var t_alert = async_test('Expecting alerts: ["PASS (1/2)","PASS (2/2)"]' );
19 var expected_alerts = ["PASS (1/2)", "PASS (2/2)"];
20
21 function alert_assert(msg) {
22 t_alert.step(function() {
23 if (msg.match(/^FAIL/i)) {
24 assert_unreached(msg);
25 t_alert.done();
26 }
27 for (var i = 0; i < expected_alerts.length; i++) {
28 if (expected_alerts[i] == msg) {
29 assert_true(expected_alerts[i] == msg);
30 expected_alerts.splice(i, 1);
31 if (expected_alerts.length == 0) {
32 t_alert.done();
33 }
34 return;
35 }
36 }
37 assert_unreached('unexpected alert: ' + msg);
38 t_log.done();
39 });
40 }
41
42 </script>
43 <!-- enforcing policy:
44 script-src 'self' 'unsafe-inline' 'nonce-noncynonce' 'nonce-noncy+/nonce='; conn ect-src 'self';
45 -->
46 <script nonce="noncynonce">
47 alert_assert('PASS (1/2)');
48
49 </script>
50 <script nonce="noncy+/nonce=">
51 alert_assert('PASS (2/2)');
52
53 </script>
54 </head>
55
56 <body>
57 <p>
58 This tests the effect of a valid script-nonce value. It passes if no CSP violation is generated and the alerts are executed.
59 </p>
60 <div id="log"></div>
61 <script async defer src="../support/checkReport.sub.js?reportExists=false">< /script>
62 </body>
63
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698