B2G/QA/WebAPI Test Plan/Contacts

From MozillaWiki
< B2G‎ | QA‎ | WebAPI Test Plan
Jump to: navigation, search

B2G Contacts API Test Plan


Lead Martijn Wargers (irc: mw22)
Contributors TBD
API Description Provides read/write DOM API access to the device address book, and the contacts contained therein.
API Developer Gregory Wagner
API Project Page Contacts API
API Tracking Bugs bug 674720
API Status Delivered and ready for test


This test plan covers functional testing of the Contacts API as delivered for Boot2Gecko.


Most Contact tests can be added to Mochitest, and a test app should be created to verify the API on-device.


Contacts API is part of the nsIDOMNavigator interface, when the "dom.mozContacts.enabled" preference is set to true.

nsIDOMNavigator (subset)


The API is mentioned here: https://wiki.mozilla.org/WebAPI/ContactsAPI#Proposed_API

There is an object in window.navigator named mozContacts with the following interface: interface nsIDOMContactManager : nsISupports {

 nsIDOMDOMRequest find(in nsIDOMContactFindOptions options);
 nsIDOMDOMRequest clear();
 nsIDOMDOMRequest save(in nsIDOMContact contact);
 nsIDOMDOMRequest remove(in nsIDOMContact contact);
 nsIDOMDOMRequest getSimContacts(in DOMString type);
 attribute nsIDOMEventListener oncontactchange;


interface nsIDOMContact : nsIDOMContactProperties {

 attribute DOMString id;
 readonly attribute jsval     published;
 readonly attribute jsval     updated;
 void init(in nsIDOMContactProperties properties);  // Workaround BUG 723206


interface nsIDOMContactFindOptions : nsISupports {

 attribute DOMString filterValue;  // e.g. "Tom"
 attribute DOMString filterOp;     // e.g. "contains"
 attribute jsval filterBy;         // DOMString[], e.g. ["givenName", "nickname"]
 attribute DOMString sortBy;       // "givenName" or "familyName"
 attribute DOMString sortOrder;    // e.g. "descending"
 attribute unsigned long filterLimit;


For other (nsIDOMContactProperties, etc), see: http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/contacts/nsIDOMContactProperties.idl



  • Importing of contacts from the SIM card. See also bug 758457


Sanity Tests

  • See mochitests

Basic Negative Tests

  • Not implemented yet.

Test App Design

  • Not implemented yet.
    • Note that there is a Contacts app from inside Gaia with an import contacts feature in it.

This page is based on the WebAPI Test Plan Template