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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/blink-contrib-2/scripthash-basic-blocked.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>scripthash-basic-blocked</title>
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <script src="../support/logTest.sub.js?logs=[]"></script>
10 <script>
11 var t_alert = async_test('Expecting alerts: ["PASS (1/1)"]');
12 var expected_alerts = ["PASS (1/1)"];
13
14 function alert_assert(msg) {
15 t_alert.step(function() {
16 if (msg.match(/^FAIL/i)) {
17 assert_unreached(msg);
18 t_alert.done();
19 }
20 for (var i = 0; i < expected_alerts.length; i++) {
21 if (expected_alerts[i] == msg) {
22 assert_true(expected_alerts[i] == msg);
23 expected_alerts.splice(i, 1);
24 if (expected_alerts.length == 0) {
25 t_alert.done();
26 }
27 return;
28 }
29 }
30 assert_unreached('unexpected alert: ' + msg);
31 t_log.done();
32 });
33 }
34
35 </script>
36 <!-- enforcing policy:
37 script-src 'self' 'unsafe-inline' 'sha1-Au4uYFbkf7OYd+ACMnKq96FN3qo='; connect-s rc 'self';
38 -->
39 <script>
40 alert_assert('PASS (1/1)');
41
42 </script>
43 <script>
44 alert_assert('FAIL (1/4)');
45
46 </script>
47 <script>
48 alert_assert('FAIL (2/4)');
49
50 </script>
51 <script>
52 alert_assert('FAIL (3/4)');
53
54 </script>
55 <script>
56 alert_assert('FAIL (4/4)');
57
58 </script>
59 </head>
60
61 <body>
62 <p>
63 This tests the effect of a valid script-hash value, with one valid scrip t and several invalid ones. It passes if one alert is executed and a CSP violati on is reported.
64 </p>
65 <div id="log"></div>
66 <script async defer src="../support/checkReport.sub.js?reportExists=true&amp ;reportField=violated-directive&amp;reportValue=script-src%20&apos;sha1-Au4uYFbk f7OYd+ACMnKq96FN3qo=&apos;"></script>
67 </body>
68
69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698