B2G/QA/WebAPI Test Plan/Alarm: Difference between revisions

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


== API ==
== API ==
Describe the API here. Give a short summary, what the API does, and any considerations or preconditions for using it.
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 ===
=== Related Prefs ===

Revision as of 02:02, 26 February 2013

B2G Screen Orientation 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

A short section should be added here that describes the testing scope of this plan: both what is and is not included, broadly.

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

Marionette/JS

Test Type 1

  • Test 1
  • Test 2

Test Type 2

  • Test 1
  • Test 2

mochitest-plain

Test Type 1

  • Test 1
  • Test 2

Test Type 2

  • Test 1
  • Test 2

Test App Design

Describe application functionality here


This page is based on the WebAPI Test Plan Template