Index: LayoutTests/http/tests/push_messaging/has_permission_granted.html |
diff --git a/LayoutTests/http/tests/push_messaging/has_permission_granted.html b/LayoutTests/http/tests/push_messaging/has_permission_granted.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f7708b948a14790a413b7f7242a4fbd72a05a712 |
--- /dev/null |
+++ b/LayoutTests/http/tests/push_messaging/has_permission_granted.html |
@@ -0,0 +1,30 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<title>Push API: hasPermission resolves with granted when permission is granted</title> |
+<link rel="manifest" href="resources/push_manifest.json"> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="../serviceworker/resources/test-helpers.js"></script> |
+</head> |
+<body> |
+<script> |
+async_test(function(test) { |
+ var workerUrl = 'resources/empty_worker.js'; |
+ var workerScope = 'resources/scope/' + location.pathname; |
+ service_worker_unregister_and_register(test, workerUrl, workerScope) |
+ .then(function(serviceWorkerRegistration) { |
+ // If running manually, grant permission when prompted. |
+ if (self.testRunner) |
+ testRunner.setPushMessagingPermission(location.origin, true); |
+ return serviceWorkerRegistration.pushManager.hasPermission(); |
+ }) |
+ .then(function(permissionStatus) { |
+ assert_equals(permissionStatus, 'granted'); |
+ return service_worker_unregister_and_done(test, workerScope); |
+ }) |
+ .catch(unreached_rejection(test)); |
+}, 'Push API: hasPermission resolves with granted when permission is granted'); |
+</script> |
+</body> |
+</html> |