@@ -75,6 +75,117 @@ add_task(async function () {
7575 ) ;
7676} ) ;
7777
78+ add_task (
79+ { skip_if : ( ) => ! AppConstants . MOZ_ENTERPRISE } ,
80+ async function test_disk_encryption_row ( ) {
81+ // XPCOM registrations are process-local.
82+ const CASES = [
83+ {
84+ status : "full" ,
85+ method : "filevault" ,
86+ text : "Enabled (FileVault)" ,
87+ } ,
88+ {
89+ status : "full" ,
90+ method : "zfs" ,
91+ text : "Enabled (ZFS)" ,
92+ } ,
93+ {
94+ status : "enabled" ,
95+ method : "dm-crypt" ,
96+ text : "Enabled (dm-crypt); inspection incomplete" ,
97+ } ,
98+ {
99+ status : "partial" ,
100+ method : "bitlocker" ,
101+ text : "Partial (BitLocker); some mounted fixed volumes are not encrypted" ,
102+ } ,
103+ {
104+ status : "disabled" ,
105+ method : "dm-crypt" ,
106+ text : "Disabled" ,
107+ } ,
108+ {
109+ status : "in-progress" ,
110+ method : "bitlocker" ,
111+ text : "Encryption or decryption in progress" ,
112+ } ,
113+ {
114+ // The wrapper normalizes an empty method to null.
115+ status : "unknown" ,
116+ method : "" ,
117+ text : "Unknown" ,
118+ } ,
119+ ] ;
120+
121+ await BrowserTestUtils . withNewTab (
122+ { gBrowser, url : "about:support" } ,
123+ async browser => {
124+ for ( const testCase of CASES ) {
125+ const [ l10nArgs , hidden ] = await SpecialPowers . spawn (
126+ browser ,
127+ [ testCase ] ,
128+ async expected => {
129+ const { MockRegistrar } = ChromeUtils . importESModule (
130+ "resource://testing-common/MockRegistrar.sys.mjs"
131+ ) ;
132+ const { Troubleshoot } = ChromeUtils . importESModule (
133+ "resource://gre/modules/Troubleshoot.sys.mjs"
134+ ) ;
135+
136+ const cid = MockRegistrar . register (
137+ "@mozilla.org/enterprise/disk-encryption-checker;1" ,
138+ {
139+ QueryInterface : ChromeUtils . generateQI ( [
140+ Ci . nsIDiskEncryptionChecker ,
141+ ] ) ,
142+ getDiskEncryption ( callback ) {
143+ callback . onComplete ( expected . status , expected . method ) ;
144+ } ,
145+ }
146+ ) ;
147+
148+ const doc = content . document ;
149+ const id = `security-software-disk-encryption-${ expected . status } ` ;
150+ try {
151+ const snapshot = await Troubleshoot . snapshot ( ) ;
152+ content . wrappedJSObject . snapshotFormatters . securitySoftware (
153+ Cu . cloneInto ( snapshot . securitySoftware , content )
154+ ) ;
155+
156+ const cell = doc . getElementById (
157+ "security-software-disk-encryption"
158+ ) ;
159+ // Wait for Fluent to replace the previous case's text.
160+ await ContentTaskUtils . waitForCondition (
161+ ( ) =>
162+ doc . l10n . getAttributes ( cell ) . id === id &&
163+ cell . textContent . trim ( ) === expected . text ,
164+ `${ id } rendered as "${ expected . text } ", got "${ cell . textContent . trim ( ) } "`
165+ ) ;
166+ return [
167+ doc . l10n . getAttributes ( cell ) . args ,
168+ doc . getElementById ( "security-software-disk-encryption-row" )
169+ . hidden ,
170+ ] ;
171+ } finally {
172+ MockRegistrar . unregister ( cid ) ;
173+ }
174+ }
175+ ) ;
176+
177+ Assert . equal (
178+ l10nArgs . method ,
179+ testCase . method ,
180+ "The method reaches Fluent, empty when there is none"
181+ ) ;
182+ Assert . ok ( ! hidden , "The disk encryption row is shown" ) ;
183+ }
184+ }
185+ ) ;
186+ }
187+ ) ;
188+
78189add_task ( async function test_nimbus_experiments ( ) {
79190 await ExperimentAPI . ready ( ) ;
80191 let doExperimentCleanup = await NimbusTestUtils . enrollWithFeatureConfig ( {
0 commit comments