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

Side by Side Diff: LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-fetch.html

Issue 1279163005: Initial Fetch integration for Subresource Integrity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 <title>Tests integrity enforcement on fetch()</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 var SRITest = function(pass, name, src, integrity) {
11 this.pass = pass;
12 this.name = name;
13 this.src = src;
14 this.integrity = integrity;
15 }
16 SRITest.prototype.execute = function() {
17 var test = async_test(this.name);
18 var pass = this.pass;
19 var integrity = this.integrity;
20 var options = {};
21 if (integrity !== '') {
22 options.integrity = integrity;
23 }
24 fetch(this.src, options)
25 .then(test.step_func(function(response) {
26 if (pass) {
27 test.done();
28 } else {
29 assert_unreached("Response on bad fetch.");
30 }
31 }))
32 .catch(test.step_func(function(error) {
33 if (pass) {
34 assert_unreached("Network error on good fetch.");
35 } else {
36 test.done();
37 }
38 }));
39 }
40
41 new SRITest(true, 'No integrity', 'call-success.js', '').execute();
42 new SRITest(true, 'Good integrity', 'call-success.js', 'sha256-B0/62fJSJFrdjEFR9 ba04m/D+LHQ+zG6PGcaR0Trpxg=').execute();
43 new SRITest(false, 'Bad integrity', 'call-success.js', 'sha256-deadbeef').execut e();
44 </script>
45 </body>
46 </html>
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ScriptLoader.cpp » ('j') | Source/modules/fetch/BodyStreamBuffer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698