Bug 674957 - mochitests-5: test_alerts.htmltimed out after 330 seconds. r=sdwilsh

This commit is contained in:
Brian R. Bondy 2011-09-21 12:54:50 -04:00
Родитель 5b2e4e5df1
Коммит c76c370742
1 изменённых файлов: 25 добавлений и 28 удалений

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

@ -22,25 +22,25 @@ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var observer = {
observe: function (aSubject, aTopic, aData) {
if (aTopic == "alertclickcallback")
if (aTopic == "alertclickcallback") {
todo(false, "Did someone click the notification while running mochitests? (Please don't.)");
else
} else {
is(aTopic, "alertfinished", "Checking the topic for a finished notification");
}
is(aData, "foobarcookie", "Checking whether the alert cookie was passed correctly");
// finish(), yet let the test actually end first, to be safe.
SimpleTest.executeSoon(SimpleTest.finish);
SimpleTest.finish();
}
};
const Cc = Components.classes;
const Ci = Components.interfaces;
function runTest() {
const Cc = Components.classes;
const Ci = Components.interfaces;
var gNotificationIsAvailable;
if (!("@mozilla.org/alerts-service;1" in Cc)) {
todo(false, "Alerts service does not exist in this application");
return;
}
if (!("@mozilla.org/alerts-service;1" in Cc)) {
todo(false, "Alerts service does not exist in this application");
} else {
ok(true, "Alerts service exists in this application");
var notifier;
@ -49,28 +49,25 @@ if (!("@mozilla.org/alerts-service;1" in Cc)) {
getService(Ci.nsIAlertsService);
ok(true, "Alerts service is available");
} catch (ex) {
todo(false, "Alerts service is not available. (Mac OS X without Growl?)", ex);
todo(false,
"Alerts service is not available. (Mac OS X without Growl?)", ex);
return;
}
if (notifier) {
try {
notifier.showAlertNotification(null, "Notification test",
"Surprise! I'm here to test notifications!",
false, "foobarcookie", observer);
ok(true, "showAlertNotification() succeeded");
gNotificationIsAvailable = true;
} catch (ex) {
todo(false, "showAlertNotification() failed. (Mac OS X without Growl?)", ex);
}
try {
SimpleTest.waitForExplicitFinish();
notifier.showAlertNotification(null, "Notification test",
"Surprise! I'm here to test notifications!",
false, "foobarcookie", observer);
ok(true, "showAlertNotification() succeeded. Waiting for notification...");
} catch (ex) {
todo(false, "showAlertNotification() failed. (Mac OS X without Growl?)", ex);
SimpleTest.finish();
}
}
if (gNotificationIsAvailable) {
// Wait for the (asynchronous) notification callback.
SimpleTest.waitForExplicitFinish();
ok(true, "Waiting for notification callback to be triggered...");
}
runTest();
</script>
</pre>
</body>