B2G/QA/WebAPI Test Plan/Alarm

From MozillaWiki
Jump to navigation Jump to search

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

Describe the API here. Give a short summary, what the API does, and any considerations or preconditions for using it.

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