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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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";
    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() {
    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.");
    25         let buttons = notification.getElementsByClassName("notification-button-default");
    26         is(buttons.length, 1, "We expect see one default button.");
    28         buttons = notification.getElementsByClassName("notification-button");
    29         is(buttons.length, 1, "We expect see one button.");
    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.");
    35         finish();
    36     }, 100);
    38     window.gBrowser.selectedBrowser.loadURI(testURI);
    39 }

mercurial