Personal tools

B2G/QA/WebAPI Test Plan/Alarm

From MozillaWiki

Jump to: navigation, search

Contents

B2G Alarm API Test Plan

Summary

Lead Geo Mealer (irc: geo)
API Description Schedule a notification, or for an application to be started, at a specific time.
API Developer Gene Lian
API Project Page Alarm API
API Tracking Bugs bug 749551
API Status Ready

Scope

This test plan covers functional testing of the Alarm API as delivered for Boot2Gecko, i.e. adding alarms, removing them, and getting all alarms. It does not attempt to cover performance, security, or other kinds of testing at this time.

Strategy

Raw info from dev, this will be formatted:

[Gene] Personally, I'd like to have some (basic) testing items as below:

1. An "honorTimezone"/"ignoreTimezone" alarm can be successfully added:

 var alarmId;
 var domRequest = navigator.mozAlarms.add(new Date("July 10, 2012 18:00:00"), "honorTimezone", { mydata: "bar" });
 domRequest.onsuccess = function (e) { alarmId = e.target.result; };
 domRequest.onerror = function (e) { alert("error"); };

2. The information of added alarms can be successfully retrieved:

 var domRequest = navigator.mozAlarms.getAll();
 domRequest.onsuccess = function (e) { alert(JSON.stringify(e.target.result)); };
 domRequest.onerror = function (e) { alert("error"); };

3. An added alarm can be successfully fired at the specified time. That is, the web page can get a system message named "alarm" and execute its corresponding callback function when the alarm goes off:

 navigator.setMessageHandler("alarm", function (message) { alert("alarm fired: " + JSON.stringify(message)); });

4. An added alarm can be successfully removed (also, the alarm won't be fired if it's already been removed):

 navigator.mozAlarms.remove(alarmId);

API

To provide DOM API access to the system alarm settings, which can schedule a notification or for an application to be started at a specific time. For example, some applications like Alarm Clock, Calendar or E-Mail might need to utilize the Alarm API to wake up the sytem and trigger particular behaviors at specified time points.

Allows adding, removing and querying for all alarms.

Related Prefs

dom.mozAlarms.enabled -- whether navigator.mozAlarms exists.

nsIDOMAlarmsManager

Methods

  • nsIDOMDOMRequest getAll()
  • nsIDOMDOMRequest add(in jsval date, in DOMString respectTimezone, [optional] in jsval data)
  • void remove(in unsigned long id)

Events

  • alarm - (System Message)

Tests

mochitest-plain

Test Type 1

  • Test 1
  • Test 2

Test Type 2

  • Test 1
  • Test 2

This page is based on the WebAPI Test Plan Template