OLD | NEW |
(Empty) | |
| 1 importScripts('/resources/testharness.js'); |
| 2 console.log('hehehe'); |
| 3 const url = '../call-success.js'; |
| 4 const integrity = 'sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg='; |
| 5 |
| 6 promise_test(() => { |
| 7 return fetch(url).then(res => res.text()).then(text => { |
| 8 assert_equals(text, 'success();\n'); |
| 9 }); |
| 10 }, 'No integrity'); |
| 11 |
| 12 promise_test(() => { |
| 13 return fetch(url, {integrity: integrity}).then(res => { |
| 14 return res.text(); |
| 15 }).then(text => { |
| 16 assert_equals(text, 'success();\n'); |
| 17 }); |
| 18 }, 'Good integrity'); |
| 19 |
| 20 promise_test(() => { |
| 21 return fetch(url, {integrity: 'sha256-deadbeaf'}).then(res => { |
| 22 assert_unreached('the integrity check should fail'); |
| 23 }, () => { |
| 24 // The integrity check should fail. |
| 25 }); |
| 26 }, 'Bad integrity'); |
| 27 |
| 28 done(); |
OLD | NEW |