browser/base/content/test/general/browser_registerProtocolHandler_notification.js

changeset 1
ca08bd8f51b2
equal deleted inserted replaced
-1:000000000000 0:29bc916372ef
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 function test() {
6 waitForExplicitFinish();
7 let notificationValue = "Protocol Registration: testprotocol";
8 let testURI = "http://example.com/browser/" +
9 "browser/base/content/test/general/browser_registerProtocolHandler_notification.html";
10
11 waitForCondition(function() {
12 // Do not start until the notification is up
13 let notificationBox = window.gBrowser.getNotificationBox();
14 let notification = notificationBox.getNotificationWithValue(notificationValue);
15 return notification;
16 },
17 function() {
18
19 let notificationBox = window.gBrowser.getNotificationBox();
20 let notification = notificationBox.getNotificationWithValue(notificationValue);
21 ok(notification, "Notification box should be displayed");
22 is(notification.type, "info", "We expect this notification to have the type of 'info'.");
23 isnot(notification.image, null, "We expect this notification to have an icon.");
24
25 let buttons = notification.getElementsByClassName("notification-button-default");
26 is(buttons.length, 1, "We expect see one default button.");
27
28 buttons = notification.getElementsByClassName("notification-button");
29 is(buttons.length, 1, "We expect see one button.");
30
31 let button = buttons[0];
32 isnot(button.label, null, "We expect the add button to have a label.");
33 todo_isnot(button.accesskey, null, "We expect the add button to have a accesskey.");
34
35 finish();
36 }, 100);
37
38 window.gBrowser.selectedBrowser.loadURI(testURI);
39 }

mercurial