| Index: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/securitypolicyviolation-helper.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/securitypolicyviolation-helper.js b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/securitypolicyviolation-helper.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a2b51948926f170882c1c273cf76b25611d0bdb3
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/securitypolicyviolation-helper.js
|
| @@ -0,0 +1,25 @@
|
| +function generateURL(type) {
|
| + return 'http://localhost:8000/security/contentSecurityPolicy/resources/loaded.js?' + type;
|
| +}
|
| +
|
| +function assert_script_failed(t, url, line) {
|
| + window.addEventListener('message', t.step_func(e => {
|
| + if (e.data == url)
|
| + t.unreached_func("Script should not have loaded.");
|
| + }));
|
| + document.addEventListener('securitypolicyviolation', t.step_func(e => {
|
| + if (e.lineNumber == line)
|
| + t.done();
|
| + }));
|
| +}
|
| +
|
| +function assert_script_loads(t, url, line) {
|
| + window.addEventListener('message', t.step_func(e => {
|
| + if (e.data == url)
|
| + t.done();
|
| + }));
|
| + document.addEventListener('securitypolicyviolation', t.step_func(e => {
|
| + if (e.lineNumber == line)
|
| + t.unreached_func("Script should not have failed.");
|
| + }));
|
| +}
|
|
|