B2G/QA/WebAPI Test Plan/Contacts
Contents
B2G Contacts API Test Plan
Summary
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 |
Scope
This test plan covers functional testing of the Contacts API as delivered for Boot2Gecko.
Strategy
Most Contact tests can be added to Mochitest, and a test app should be created to verify the API on-device.
API
Contacts API is part of the nsIDOMNavigator interface, when the "dom.mozContacts.enabled" preference is set to true.
Attributes
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
Tests
Marionette/JS
- Importing of contacts from the SIM card. See also bug 758457
mochitest-plain
- Existing tests: http://mxr.mozilla.org/mozilla-central/source/dom/contacts/tests/
- More tests needed for various input validations. For example pass arrays into the API instead of singe strings
- Tests needed for the find function
- Tests needed for the oncontactChange event
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
URLS
- http://mxr.mozilla.org/mozilla-central/source/dom/contacts/ContactManager.js#513
- http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/contacts/nsIDOMContactManager.idl#37
- http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/contacts/nsIDOMContactProperties.idl#43
- http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/contacts/nsIDOMMozContactChangeEvent.idl