diff --git a/test/assets/csp.html b/test/assets/csp.html
new file mode 100644
index 00000000..34fc1fc1
--- /dev/null
+++ b/test/assets/csp.html
@@ -0,0 +1 @@
+
diff --git a/test/page.spec.js b/test/page.spec.js
index f000045a..04b27c32 100644
--- a/test/page.spec.js
+++ b/test/page.spec.js
@@ -1508,6 +1508,18 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
await page.goto(server.PREFIX + '/tamperable.html');
expect(await page.evaluate(() => window.result)).toBe(123);
});
+ it('should work with CSP', async({page, server}) => {
+ server.setCSP('/empty.html', 'script-src ' + server.PREFIX);
+ await page.evaluateOnNewDocument(function(){
+ window.injected = 123;
+ });
+ await page.goto(server.PREFIX + '/empty.html');
+ expect(await page.evaluate(() => window.injected)).toBe(123);
+
+ // Make sure CSP works.
+ await page.addScriptTag({content: 'window.e = 10;'}).catch(e => void e);
+ expect(await page.evaluate(() => window.e)).toBe(undefined);
+ });
});
describe('Page.setCacheEnabled', function() {