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.

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

mercurial