diff --git a/services/fxaccounts/tests/browser/browser_verify_remotetabs_notif.js b/services/fxaccounts/tests/browser/browser_verify_remotetabs_notif.js index c1946165c7f24..db6aa6affc67a 100644 --- a/services/fxaccounts/tests/browser/browser_verify_remotetabs_notif.js +++ b/services/fxaccounts/tests/browser/browser_verify_remotetabs_notif.js @@ -84,67 +84,6 @@ mjs ; / / -Since -we -show -the -brand -name -( -Nightly -Beta -) -in -the -notification -/ -/ -we -need -to -fetch -the -localization -so -the -test -doesn -' -t -break -when -going -/ -/ -through -the -trains -const -l10n -= -new -Localization -( -[ -" -branding -/ -brand -. -ftl -" -" -browser -/ -accounts -. -ftl -" -] -) -; -/ -/ URL that opens @@ -230,69 +169,6 @@ notification ; / / -Get -the -expected -notification -text -we -' -ll -show -the -user -const -[ -expectedTitle -expectedBody -] -= -await -l10n -. -formatValues -( -[ -{ -id -: -" -account -- -tabs -- -closed -- -remotely -" -args -: -{ -closedCount -: -1 -} -} -{ -id -: -" -account -- -view -- -recently -- -closed -- -tabs -" -} -] -) -; -/ -/ This will also @@ -317,10 +193,20 @@ setupMockAlertsService { title : -expectedTitle +" +1 +Nightly +tab +closed +" body : -expectedBody +" +View +recently +closed +tabs +" } ) ; @@ -562,69 +448,6 @@ notification ; / / -Get -the -expected -notification -text -we -' -ll -show -the -user -const -[ -expectedTitle -expectedBody -] -= -await -l10n -. -formatValues -( -[ -{ -id -: -" -account -- -tabs -- -closed -- -remotely -" -args -: -{ -closedCount -: -2 -} -} -{ -id -: -" -account -- -view -- -recently -- -closed -- -tabs -" -} -] -) -; -/ -/ This will also @@ -649,10 +472,20 @@ setupMockAlertsService { title : -expectedTitle +" +2 +Nightly +tabs +closed +" body : -expectedBody +" +View +recently +closed +tabs +" } ) ; diff --git a/services/fxaccounts/tests/xpcshell/test_commands_closetab.js b/services/fxaccounts/tests/xpcshell/test_commands_closetab.js index 5d2308b66a73f..ff2a93284fe55 100644 --- a/services/fxaccounts/tests/xpcshell/test_commands_closetab.js +++ b/services/fxaccounts/tests/xpcshell/test_commands_closetab.js @@ -62,7 +62,6 @@ mjs const { COMMAND_CLOSETAB -COMMAND_CLOSETAB_TAIL } = ChromeUtils @@ -1117,6 +1116,106 @@ shutdown ( ) ; +/ +* +/ +/ +Test +telemetry +differently +- +this +will +fail +as +we +mocked +out +the +send +call +. +/ +/ +https +: +/ +/ +bugzilla +. +mozilla +. +org +/ +show_bug +. +cgi +? +id += +1899453 +Assert +. +deepEqual +( +fxai +. +telemetry +. +_events +[ +{ +object +: +" +command +- +sent +" +method +: +COMMAND_CLOSETAB_TAIL +value +: +" +dev1 +- +san +" +/ +/ +streamID +uses +the +same +generator +as +flowId +so +it +will +be +2 +extra +: +{ +flowID +: +" +1 +" +streamID +: +" +2 +" +} +} +] +) +; +* +/ } ) ; @@ -1585,15 +1684,15 @@ verify ( ) ; -mock +closeTab . -restore +shutdown ( ) ; -closeTab +mock . -shutdown +restore ( ) ; @@ -1881,18 +1980,15 @@ should ve been called -at -least twice Assert . -ok +equal ( ensureTimerSpy . callCount -> -1 +2 ) ; mock @@ -1901,319 +1997,6 @@ verify ( ) ; -mock -. -restore -( -) -; -closeTab -. -shutdown -( -) -; -} -) -; -add_task -( -async -function -test_telemetry_on_sendCloseTabPush -( -) -{ -const -targetDevice -= -{ -id -: -" -dev1 -" -name -: -" -Device -1 -" -availableCommands -: -{ -[ -COMMAND_CLOSETAB -] -: -" -payload -" -} -} -; -const -fxai -= -FxaInternalMock -( -[ -targetDevice -] -) -; -/ -/ -Stub -out -invoke -and -_encrypt -since -we -' -re -mainly -testing -/ -/ -the -telemetry -gets -called -okay -const -commands -= -{ -_invokes -: -[ -] -invoke -( -cmd -device -payload -) -{ -this -. -_invokes -. -push -( -{ -cmd -device -payload -} -) -; -} -} -; -const -closeTab -= -new -CloseRemoteTab -( -commands -fxai -) -; -closeTab -. -_encrypt -= -( -) -= -> -" -encryptedpayload -" -; -/ -/ -freeze -" -now -" -to -< -= -when -the -command -was -sent -. -let -now -= -Date -. -now -( -) -; -closeTab -. -now -= -( -) -= -> -now -; -/ -/ -Set -the -delay -to -10ms -closeTab -. -DELAY -= -10 -; -/ -/ -Use -the -real -_sendCloseTabPush -method -let -command1 -= -new -RemoteCommand -. -CloseTab -( -" -https -: -/ -/ -foo -. -bar -/ -early -" -) -; -const -store -= -await -getRemoteCommandStore -( -) -; -await -store -. -addRemoteCommandAt -( -targetDevice -. -id -command1 -now -- -15 -) -; -await -closeTab -. -flushQueue -( -) -; -/ -/ -Move -" -now -" -to -be -20ms -timer -- -ie -pretending -the -timer -fired -. -now -+ -= -20 -; -await -closeTab -. -flushQueue -( -) -; -Assert -. -deepEqual -( -fxai -. -telemetry -. -_events -[ -{ -object -: -" -command -- -sent -" -method -: -COMMAND_CLOSETAB_TAIL -value -: -" -dev1 -- -san -" -extra -: -{ -flowID -: -" -1 -" -streamID -: -" -2 -" -} -} -] -) -; closeTab . shutdown