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

Unified Diff: LayoutTests/http/tests/notifications/click-window-focus-document.html

Issue 1312623003: Flakyness: fix notifications/ tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@webmidi-flakyness
Patch Set: rebase Created 5 years, 3 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/notifications/click-window-focus-document.html
diff --git a/LayoutTests/http/tests/notifications/click-window-focus-document.html b/LayoutTests/http/tests/notifications/click-window-focus-document.html
index 937aa0251c360e21fd762b9d4e9c510ed32ab0c4..e7d2a649d6db62c60ce95c56ed2a9a387d765f5e 100644
--- a/LayoutTests/http/tests/notifications/click-window-focus-document.html
+++ b/LayoutTests/http/tests/notifications/click-window-focus-document.html
@@ -4,6 +4,7 @@
<title>Notifications: Should be able to focus window in onclick event.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
+ <script src="../resources/permissions-helper.js"></script>
</head>
<body>
<script>
@@ -13,36 +14,36 @@
if (window.testRunner) {
testRunner.setCanOpenWindows();
testRunner.setCloseRemainingWindowsWhenComplete();
- testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
}
async_test(function(test) {
- if (Notification.permission != 'granted') {
- assert_unreached('No permission has been granted for displaying notifications.');
- return;
- }
+ PermissionsHelper.setPermission('notifications', 'granted').then(test.step_func(function() {
+ if (Notification.permission != 'granted') {
+ assert_unreached('No permission has been granted for displaying notifications.');
+ return;
+ }
- window.addEventListener('focus', function() {
- test.done();
- });
+ window.addEventListener('focus', test.step_func(function() {
+ test.done();
+ }));
- var childWindow = window.open('about:blank');
- childWindow.focus();
+ var childWindow = window.open('about:blank');
+ childWindow.focus();
- var notification = new Notification('My Notification');
- notification.addEventListener('show', function() {
- if (window.testRunner)
- testRunner.simulateWebNotificationClick('My Notification');
- });
+ var notification = new Notification('My Notification');
+ notification.addEventListener('show', test.step_func(function() {
+ if (window.testRunner)
+ testRunner.simulateWebNotificationClick('My Notification');
+ }));
- notification.addEventListener('click', function() {
- window.focus();
- });
-
- notification.addEventListener('error', function() {
- assert_unreached('The error event should not be thrown.');
- });
+ notification.addEventListener('click', test.step_func(function() {
+ window.focus();
+ }));
+ notification.addEventListener('error', test.step_func(function() {
+ assert_unreached('The error event should not be thrown.');
+ }));
+ }));
}, 'Clicking on a notification enables it to focus the window it was created from.');
</script>
<script src="resources/click-focus-test.js"></script>
« no previous file with comments | « LayoutTests/http/tests/notifications/click-document.html ('k') | LayoutTests/http/tests/notifications/close-document.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698