Power Management

From MozillaWiki
Jump to: navigation, search

B2G Power Management API Test Plan

Summary

Lead Geo Mealer (irc: geo)
API Description Turn on/off screen, cpu, device power, etc. Listen and inspect resource lock events.
API Developer Kan-Ru Chen (irc: kanru)
API Project Page Power Management API
API Tracking Bugs bug 708964
API Status Ready

Scope

This test plan covers functional testing of the Power Management API on B2G.

Strategy

API

Related Prefs / Permissions

Require power permission to access methods and attributes on navigator.mozPower.

nsIDOMPowerManager

Methods

  • void powerOff()
  • void reboot()
  • void restart()
  • void powerOff()
  • void addWakeLockListener(WakeLockListener listener)
  • void removeWakeLockListener(WakeLockListener listener)
  • DOMString getWakeLockState(DOMString topic)

Attributes

  • boolean screenEnabled
  • boolean screenBrightness
  • boolean cpuSleepAllowed

Tests

mochitest-plain

Methods

Some of these can't be tested with mochitests (powerOff, reboot and restart). There already exist some tests for wakelocks.

Properties

Setting the properties and reading them back to confirm the change was indeed set. screenBrightness is special since setting it a value does not guarantee that'll be the value you get back due to varying levels of support for screen backlight levels and general float precision. Thus, we use a fuzzy equals which basically compares plus-or-minus some small epsilon.


This page is based on the WebAPI Test Plan Template