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

Unified Diff: LayoutTests/http/tests/security/suborigins/suborigin-blocked-notifications.php

Issue 27073003: CSP Suborigins Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address many of mkwst's comments Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/security/suborigins/suborigin-blocked-notifications.php
diff --git a/LayoutTests/http/tests/security/suborigins/suborigin-blocked-notifications.php b/LayoutTests/http/tests/security/suborigins/suborigin-blocked-notifications.php
new file mode 100644
index 0000000000000000000000000000000000000000..5dddbe7eb41582019e678787d205eb54c108f5a7
--- /dev/null
+++ b/LayoutTests/http/tests/security/suborigins/suborigin-blocked-notifications.php
@@ -0,0 +1,30 @@
+<?php
+header("Content-Security-Policy: suborigin foobar1");
+?>
+<!DOCTYPE html>
+<html>
+<head>
+<title>Notifications are denied in suborigins.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<script>
+ async_test(function (test) {
+ testRunner.grantWebNotificationPermission(location.origin, true);
Mike West 2015/04/13 10:03:35 It would be good to discuss this kind of thing wit
+ Notification.requestPermission(function (status) {
+ assert_equals(status, 'default');
+
+ var notification = new Notification('My Notification');
+ notification.addEventListener('show', function() {
+ assert_unreached('The notification is not expected to be shown.');
+ });
+
+ notification.addEventListener('error', function() {
+ test.done();
+ });
+ });
+ }, 'Notification creation fails when requested from a suborigin.');
+</script>
+</script>
+<iframe id="iframe" src="resources/childsuborigin.php?suborigin=foobar2"></iframe>
+</html>

Powered by Google App Engine
This is Rietveld 408576698