From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../protocolhandler/test/browser/browser.ini | 5 ++ ...owser_registerProtocolHandler_notification.html | 15 ++++ ...browser_registerProtocolHandler_notification.js | 63 ++++++++++++++++ .../protocolhandler/test/test_registerHandler.html | 88 ++++++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 browser/components/protocolhandler/test/browser/browser.ini 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.ini b/browser/components/protocolhandler/test/browser/browser.ini new file mode 100644 index 0000000000..4ed1c68974 --- /dev/null +++ b/browser/components/protocolhandler/test/browser/browser.ini @@ -0,0 +1,5 @@ +[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..1b44c7daa4 --- /dev/null +++ b/browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.js @@ -0,0 +1,63 @@ +/* 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.loadURI(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'." + ); + + // Make sure the CSS is fully loaded... + ok( + await TestUtils.waitForCondition( + () => + notification.ownerGlobal.getComputedStyle( + notification.messageImage, + "::after" + ).content == 'url("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..d61dd2687e --- /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