mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 816893 - Part 4: Marionette tests for reading Sim Contact. r=hsinyi
This commit is contained in:
parent
14f35a6599
commit
6e23fa9d2b
6
dom/contacts/tests/marionette/manifest.ini
Normal file
6
dom/contacts/tests/marionette/manifest.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
b2g = true
|
||||
browser = false
|
||||
qemu = true
|
||||
|
||||
[test_sim_contacts.js]
|
59
dom/contacts/tests/marionette/test_sim_contacts.js
Normal file
59
dom/contacts/tests/marionette/test_sim_contacts.js
Normal file
@ -0,0 +1,59 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("contacts-read", true, document);
|
||||
|
||||
let mozContacts = window.navigator.mozContacts;
|
||||
ok(mozContacts);
|
||||
|
||||
function testImportSimContacts() {
|
||||
let request = mozContacts.getSimContacts("ADN");
|
||||
request.onsuccess = function onsuccess() {
|
||||
let simContacts = request.result;
|
||||
|
||||
// These SIM contacts are harded in external/qemu/telephony/sim_card.c
|
||||
is(simContacts.length, 4);
|
||||
|
||||
is(simContacts[0].name, "Mozilla");
|
||||
is(simContacts[0].tel[0].value, "15555218201");
|
||||
|
||||
is(simContacts[1].name, "Saßê黃");
|
||||
is(simContacts[1].tel[0].value, "15555218202");
|
||||
|
||||
is(simContacts[2].name, "Fire 火");
|
||||
is(simContacts[2].tel[0].value, "15555218203");
|
||||
|
||||
is(simContacts[3].name, "Huang 黃");
|
||||
is(simContacts[3].tel[0].value, "15555218204");
|
||||
|
||||
runNextTest();
|
||||
};
|
||||
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "Cannot get Sim Contacts");
|
||||
runNextTest();
|
||||
};
|
||||
};
|
||||
|
||||
let tests = [
|
||||
testImportSimContacts,
|
||||
];
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
test();
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
SpecialPowers.removePermission("contacts-read", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
@ -19,6 +19,7 @@ skip = false
|
||||
[include:../../../../../dom/system/gonk/tests/marionette/manifest.ini]
|
||||
[include:../../../../../dom/icc/tests/marionette/manifest.ini]
|
||||
[include:../../../../../dom/system/tests/marionette/manifest.ini]
|
||||
[include:../../../../../dom/contacts/tests/marionette/manifest.ini]
|
||||
|
||||
; marionette unit tests
|
||||
[include:unit/unit-tests.ini]
|
||||
|
Loading…
Reference in New Issue
Block a user