From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../protocolhandler/test/browser/browser.toml | 5 ++ ...owser_registerProtocolHandler_notification.html | 15 ++++ ...browser_registerProtocolHandler_notification.js | 57 ++++++++++++++ .../protocolhandler/test/test_registerHandler.html | 88 ++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 browser/components/protocolhandler/test/browser/browser.toml create mode 100644 browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.html create mode 100644 browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.js create mode 100644 browser/components/protocolhandler/test/test_registerHandler.html (limited to 'browser/components/protocolhandler/test') diff --git a/browser/components/protocolhandler/test/browser/browser.toml b/browser/components/protocolhandler/test/browser/browser.toml new file mode 100644 index 0000000000..73a0ad72d2 --- /dev/null +++ b/browser/components/protocolhandler/test/browser/browser.toml @@ -0,0 +1,5 @@ +[DEFAULT] + +["browser_registerProtocolHandler_notification.js"] +support-files = ["browser_registerProtocolHandler_notification.html"] +skip-if = ["verify"] diff --git a/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.html b/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.html new file mode 100644 index 0000000000..6ffacd2e85 --- /dev/null +++ b/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.html @@ -0,0 +1,15 @@ + + + + Protocol registrar page + + + + + + + diff --git a/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.js b/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.js new file mode 100644 index 0000000000..e2598ae281 --- /dev/null +++ b/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.js @@ -0,0 +1,57 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const TEST_PATH = getRootDirectory(gTestPath).replace( + "chrome://mochitests/content", + "https://example.com" +); +add_task(async function () { + let notificationValue = "Protocol Registration: web+testprotocol"; + let testURI = TEST_PATH + "browser_registerProtocolHandler_notification.html"; + + BrowserTestUtils.startLoadingURIString( + window.gBrowser.selectedBrowser, + testURI + ); + await TestUtils.waitForCondition( + function () { + // Do not start until the notification is up + let notificationBox = window.gBrowser.getNotificationBox(); + let notification = + notificationBox.getNotificationWithValue(notificationValue); + return notification; + }, + "Still can not get notification after retrying 100 times.", + 100, + 100 + ); + + let notificationBox = window.gBrowser.getNotificationBox(); + let notification = + notificationBox.getNotificationWithValue(notificationValue); + ok(notification, "Notification box should be displayed"); + if (notification == null) { + finish(); + return; + } + is( + notification.getAttribute("type"), + "info", + "We expect this notification to have the type of 'info'." + ); + is( + notification.messageImage.getAttribute("src"), + "chrome://global/skin/icons/info-filled.svg", + "We expect this notification to have an icon." + ); + + let buttons = notification.buttonContainer.getElementsByClassName( + "notification-button" + ); + is(buttons.length, 1, "We expect see one button."); + + let button = buttons[0]; + isnot(button.label, null, "We expect the add button to have a label."); + todo(button.accesskey, "We expect the add button to have a accesskey."); +}); diff --git a/browser/components/protocolhandler/test/test_registerHandler.html b/browser/components/protocolhandler/test/test_registerHandler.html new file mode 100644 index 0000000000..2eb4f7dbdc --- /dev/null +++ b/browser/components/protocolhandler/test/test_registerHandler.html @@ -0,0 +1,88 @@ + + + + + Test for Bug 402788 + + + + +Mozilla Bug 402788 +

+ +
+
+
+ + -- cgit v1.2.3