Release Android Preview 21 and bilingual changelog
Add permission-based reading of Android contacts, SMS and call history. Include shared Gaia fixes and document device validation limits. Pixel image qualification remains pending.
This commit is contained in:
parent
1c20a0b6d5
commit
200d1fb235
43 changed files with 2271 additions and 65 deletions
29
tests/settings-panel-cache.test.mjs
Normal file
29
tests/settings-panel-cache.test.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import vm from 'node:vm';
|
||||
import {readFileSync} from 'node:fs';
|
||||
const source=readFileSync(new URL('../gaia/apps/settings/js/modules/panel_cache.js',import.meta.url),'utf8');
|
||||
function fixture(load) {
|
||||
let cache;
|
||||
function require(id,ok,fail) {
|
||||
if(Array.isArray(id))return load(ok,fail);
|
||||
if(id==='shared/lazy_loader')return {load:(_,done)=>done()};
|
||||
return ()=>({beforeShow(){}});
|
||||
}
|
||||
vm.runInNewContext(source,{define:factory=>cache=factory(require),navigator:{addIdleObserver(){}},
|
||||
document:{getElementById:()=>({querySelector:()=>({dataset:{path:'panels/storage/panel'}})})}});
|
||||
return cache;
|
||||
}
|
||||
for(const failure of ['dependency','constructor','invalid']) test('Panel cache reports '+failure+' failure without caching a broken panel',()=>{
|
||||
let broken=true;
|
||||
const expected=new Error('storage unavailable');
|
||||
const cache=fixture((ok,fail)=>{
|
||||
if(!broken)return ok(()=>({beforeShow(){}}));
|
||||
if(failure==='dependency')return fail(expected);
|
||||
ok(()=>{if(failure==='constructor')throw expected;return {};});
|
||||
});
|
||||
let calls=0;
|
||||
cache.get('mediaStorage',(panel,error)=>{calls++;assert.equal(panel,null);assert.ok(error);});
|
||||
assert.equal(calls,1);broken=false;
|
||||
cache.get('mediaStorage',(panel,error)=>{assert.equal(error,undefined);assert.equal(typeof panel.beforeShow,'function');});
|
||||
});
|
||||
Loading…
Reference in a new issue