Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mullvad Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Mullvad Browser
Commits
a67e60e2
Commit
a67e60e2
authored
1 year ago
by
Paul Zuehlcke
Browse files
Options
Downloads
Patches
Plain Diff
Bug 1879850 - Test, r=Gijs a=test-only
parent
d0623081
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js
+101
-0
101 additions, 0 deletions
...Notifications/browser_popupNotification_security_delay.js
with
101 additions
and
0 deletions
browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js
+
101
−
0
View file @
a67e60e2
...
...
@@ -294,3 +294,104 @@ add_task(async function test_notificationReshowTabSwitch() {
"
Should not longer see the notification.
"
);
});
/**
* Tests that the security delay gets reset when a window is repositioned and
* the PopupNotifications panel position is updated.
*/
add_task
(
async
function
test_notificationWindowMove
()
{
await
ensureSecurityDelayReady
();
info
(
"
Open a notification.
"
);
let
popupShownPromise
=
waitForNotificationPanel
();
showNotification
();
await
popupShownPromise
;
ok
(
PopupNotifications
.
isPanelOpen
,
"
PopupNotification should be open after show call.
"
);
// Test that the initial security delay works.
info
(
"
Trigger main action via button click during the new security delay.
"
);
triggerMainCommand
(
PopupNotifications
.
panel
);
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
0
));
ok
(
PopupNotifications
.
isPanelOpen
,
"
PopupNotification should still be open.
"
);
let
notification
=
PopupNotifications
.
getNotification
(
"
foo
"
,
gBrowser
.
selectedBrowser
);
ok
(
notification
,
"
Notification should still be open because we clicked during the security delay.
"
);
// If the notification is no longer shown (test failure) skip the remaining
// checks.
if
(
!
notification
)
{
return
;
}
info
(
"
Wait for security delay to expire.
"
);
await
new
Promise
(
resolve
=>
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
setTimeout
(
resolve
,
TEST_SECURITY_DELAY
+
500
)
);
info
(
"
Reposition the window
"
);
// Remember original window position.
let
{
screenX
,
screenY
}
=
window
;
let
promisePopupPositioned
=
BrowserTestUtils
.
waitForEvent
(
PopupNotifications
.
panel
,
"
popuppositioned
"
);
// Move the window.
window
.
moveTo
(
200
,
200
);
// Wait for the panel to reposition and the PopupNotifications listener to run.
await
promisePopupPositioned
;
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
0
));
info
(
"
Trigger main action via button click during the new security delay.
"
);
triggerMainCommand
(
PopupNotifications
.
panel
);
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
0
));
ok
(
PopupNotifications
.
isPanelOpen
,
"
PopupNotification should still be open.
"
);
notification
=
PopupNotifications
.
getNotification
(
"
foo
"
,
gBrowser
.
selectedBrowser
);
ok
(
notification
,
"
Notification should still be open because we clicked during the security delay.
"
);
// If the notification is no longer shown (test failure) skip the remaining
// checks.
if
(
!
notification
)
{
return
;
}
// Ensure that once the security delay has passed the notification can be
// closed again.
let
fakeTimeShown
=
TEST_SECURITY_DELAY
+
500
;
info
(
`Manually set timeShown to
${
fakeTimeShown
}
ms in the past.`
);
notification
.
timeShown
=
performance
.
now
()
-
fakeTimeShown
;
info
(
"
Trigger main action via button click outside security delay
"
);
let
notificationHiddenPromise
=
waitForNotificationPanelHidden
();
triggerMainCommand
(
PopupNotifications
.
panel
);
info
(
"
Wait for panel to be hidden.
"
);
await
notificationHiddenPromise
;
ok
(
!
PopupNotifications
.
getNotification
(
"
foo
"
,
gBrowser
.
selectedBrowser
),
"
Should not longer see the notification.
"
);
// Reset window position
window
.
moveTo
(
screenX
,
screenY
);
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment