Bug 960762 - Fix intermittence of Notification mochitests. r=mhenretty

--HG--
extra : rebase_source : b3fb515bef11781333661d96cdae024a27dcaa7b
This commit is contained in:
Alexandre Lissy 2015-05-18 09:49:00 +02:00
Родитель 93147b0d97
Коммит 888402fd1c
4 изменённых файлов: 19 добавлений и 16 удалений

Просмотреть файл

@ -384,7 +384,6 @@ NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
}
if (!strcmp("alertclickcallback", aTopic)) {
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMEvent(getter_AddRefs(event), mNotification, nullptr, nullptr);
nsresult rv = event->InitEvent(NS_LITERAL_STRING("click"), false, true);

Просмотреть файл

@ -6,9 +6,7 @@ support-files =
[test_notification_basics.html]
[test_notification_storage.html]
skip-if = toolkit == 'android' || toolkit == 'gonk' #bug 960762
[test_bug931307.html]
skip-if = (toolkit == 'gonk' && debug) #debug-only timeout
[test_notification_resend.html]
skip-if = e10s # On e10s, faking the app seems to be failing
[test_notification_noresend.html]

Просмотреть файл

@ -17,15 +17,16 @@ var notification = new Notification("");
var promise = Notification.get();
promise.then(
function onSuccess() {
ok(true, "No crash!");
notification.close();
SimpleTest.finish();
ok(true, "No error when creating a notification without title");
},
function onFailure() {
ok(false, "Should not get an error in promise callback");
notification.close();
ok(false, "Should not throw error when creating a notification without title");
}
);
).then(() => {
notification.close();
}).then(() => {
SimpleTest.finish();
});
</script>
</pre>

Просмотреть файл

@ -15,12 +15,13 @@
SimpleTest.requestFlakyTimeout("untriaged");
function deleteAllNotifications() {
function deleteAllNotifications(done) {
var promise = Notification.get();
promise.then(function (notifications) {
notifications.forEach(function(notification) {
notification.close();
});
done();
});
}
@ -120,10 +121,10 @@
var promise = Notification.get();
promise.then(function (notifications) {
is(notifications.length, 3, "should return 3 notifications");
done();
n1.close();
n2.close();
n3.close();
done();
});
},
@ -134,13 +135,17 @@
var n = new Notification("test-title" + Math.random());
n.onclose = function() {
Notification.get().then(function(notifications) {
is(notifications.length, 0, "should return 0 notifications");
done();
is(notifications.length, 0, "should return 0 notifications");
done();
});
}
window.setTimeout(function() {
};
info("Installing 'onshow' for " + n.title);
n.onshow = function() {
info("Triggered 'onshow' for " + n.title);
window.setTimeout(function() {
NotificationTest.fireCloseEvent(n.title);
}, 100);
}, 100);
};
}
];