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

Unified Diff: LayoutTests/fast/notifications/notifications-constructor-request-permission.html

Issue 393863002: Switch Blink to the new Web Notifications permission path. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/fast/notifications/notifications-constructor-request-permission.html
diff --git a/LayoutTests/fast/notifications/notifications-constructor-request-permission.html b/LayoutTests/fast/notifications/notifications-constructor-request-permission.html
index 65a6bf24937c12f72bdef685e0d2a86a4100ec92..0ead09f41b3d1cf684d196571fedd7f735d31b69 100644
--- a/LayoutTests/fast/notifications/notifications-constructor-request-permission.html
+++ b/LayoutTests/fast/notifications/notifications-constructor-request-permission.html
@@ -1,36 +1,47 @@
<!DOCTYPE html>
<html>
-<head>
- <script type="text/javascript">
- function log(message)
- {
- document.getElementById("result").innerHTML += message + "<br>";
- }
-
- function runTests()
- {
+ <head>
+ <script src="../../resources/js-test.js"></script>
+ </head>
+ <body>
+ <p>
+ Tests that it is possible to request permission to display Web
+ Notifications from a document context, for which the passed callback
+ will be invoked with the requests' result. It also makes sure that
+ not passing a callback won't result in a crash.
+ </p>
+ <div id="console"></div>
+ <script>
if (window.testRunner) {
testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ testRunner.clearWebNotificationPermissions();
}
- if (!window.Notification) {
- log("FAIL: No Notification interface!");
- }
-
- var N = window.Notification.requestPermission(
- function() { log("PASS: Permission callback invoked."); }
- );
- }
- </script>
-</head>
-<body>
- <p>Requesting notification permission...</p>
-
-<div id="result"></div>
-<script type="text/javascript">
-runTests();
-</script>
+ var result;
+
+ // This should not crash given that the callback is optional.
+ Notification.requestPermission();
+
+ // This should log the default permission, since no other permission
+ // has been set yet.
+ Notification.requestPermission(function (localResult) {
+ result = localResult;
+ shouldBeEqualToString("result", "default");
+
+ if (!window.testRunner) {
+ testPassed("The remainder of this test requires the TestRunner.");
+ return;
+ }
+ testRunner.grantWebNotificationPermission("file://", true);
+ Notification.requestPermission(function (localResult) {
+ result = localResult;
+ shouldBeEqualToString("result", "granted");
-</body>
+ testRunner.notifyDone();
+ });
+ });
+ </script>
+ </body>
</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/notifications/notifications-constructor-request-permission-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698