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

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: add missing file Created 5 years, 4 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..b6fee69db697027174af3f599cd9999c60e676d4 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() {
johnme 2015/08/26 12:27:32 This test supports being run manually (notice how
mlamouri (slow - plz ping) 2015/08/31 16:31:42 In order to run manually this test requires the pe
johnme 2015/09/02 10:28:24 Sort of; if you forget to grant notification permi
+ 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', function() {
johnme 2015/08/26 12:27:32 Why is this one not a test.step_func?
mlamouri (slow - plz ping) 2015/08/31 16:31:42 Because it doesn't need to be called.
+ 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>

Powered by Google App Engine
This is Rietveld 408576698