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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_registerProtocolHandler_notification.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +function test() {
     1.9 +  waitForExplicitFinish();
    1.10 +  let notificationValue = "Protocol Registration: testprotocol";
    1.11 +  let testURI = "http://example.com/browser/" +
    1.12 +    "browser/base/content/test/general/browser_registerProtocolHandler_notification.html";
    1.13 +
    1.14 +    waitForCondition(function() {
    1.15 +        // Do not start until the notification is up
    1.16 +        let notificationBox = window.gBrowser.getNotificationBox();
    1.17 +        let notification = notificationBox.getNotificationWithValue(notificationValue);
    1.18 +        return notification;
    1.19 +    },
    1.20 +    function() {
    1.21 +
    1.22 +        let notificationBox = window.gBrowser.getNotificationBox();
    1.23 +        let notification = notificationBox.getNotificationWithValue(notificationValue);
    1.24 +        ok(notification, "Notification box should be displayed");
    1.25 +        is(notification.type, "info", "We expect this notification to have the type of 'info'.");
    1.26 +        isnot(notification.image, null, "We expect this notification to have an icon.");
    1.27 +
    1.28 +        let buttons = notification.getElementsByClassName("notification-button-default");
    1.29 +        is(buttons.length, 1, "We expect see one default button.");
    1.30 +
    1.31 +        buttons = notification.getElementsByClassName("notification-button");
    1.32 +        is(buttons.length, 1, "We expect see one button.");
    1.33 +
    1.34 +        let button = buttons[0];
    1.35 +        isnot(button.label, null, "We expect the add button to have a label.");
    1.36 +        todo_isnot(button.accesskey, null, "We expect the add button to have a accesskey.");
    1.37 +
    1.38 +        finish();
    1.39 +    }, 100);
    1.40 +
    1.41 +    window.gBrowser.selectedBrowser.loadURI(testURI);
    1.42 +}

mercurial