Personal tools

B2G/QA/WebAPI Test Plan/Screen Orientation

From MozillaWiki

Jump to: navigation, search

Contents

B2G Screen Orientation API Test Plan

Summary

Lead Geo Mealer (irc: geo)
Contributors TBD
API Description Get notification when screen orientation changes as well as control which screen orientation a page/app wants.
API Developer Mounir Lamouri
API Project Page Screen Orientation
API Tracking Bugs bug 720794, bug 740188, bug 673922
API Status Delivered and ready for test

Scope

This test plan covers functional testing of the Screen Orientation API as delivered for Boot2Gecko. It does not attempt to cover performance, security, or other kinds of testing at this time.

Strategy

Screen Orientation can be tested most effectively using QEMU commands to manipulate the virtual orientation of the device, so primary testing will be via Marionette/JS through CI.

Some basic sanity tests can be added to Mochitest for other platforms, and a test app should be created to verify the API on-device.

API

Screen Orientation API is relatively simple, and is defined as part of the nsIDOMScreen interface.

It includes a basic attribute to get current orientation, methods to lock/unlock orientation to a desired value (for example, for an app that only runs in landscape), and an event to let applications know when an orientation change has occured.

Orientation locking is available to apps and frames contained in apps. A non-app can only use the locking API if it is fullscreen.

nsIDOMScreen (subset)

Attributes

  • readonly DOMString mozOrientation
    Can be landscape-primary, landscape-secondary, portrait-primary, portrait-secondary

Methods

  • boolean mozLockOrientation(in DOMString orientation)
  • void mozUnlockOrientation()

Events

  • onmozorientationchange

Tests

Marionette/JS

Tacking bug: bug 805005

Basic Positive Tests

Not implemented yet:

  • Lock orientation to each different value. (Rotate to different value first).
    • Verify mozOrientation changes as expected and onmozorientationchange fires
  • Lock orientation to the current value
    • Verify onmozorientationchange doesn't fire.
  • Rotate virtual device around Z axis
    • Verify no orientation change or event
  • Rotate virtual device around X axis
    • Verify mozOrientation changes as expected and onmozorientationchange fires
  • Rotate virtual device around Y axis
    • Verify mozOrientation changes as expected and onmozorientationchange fires

All positive tests past just sanity checking require use of the emulator to vary rotation. Emulator semantics for rotation are unknown, and initial tries didn't result in something usable. See bug 760735 for more details.

mochitest-plain

Sanity Tests

  • Verify mozOrientation in [portrait-primary|portrait-secondary|landscape-primary|landscape-secondary]

Basic Negative Tests

  • Attempt to lock orientation to invalid string
  • Attempt to lock orientation to empty string
  • Attempt to lock orientation to number
  • Attempt to lock orientation to null

Not implemented yet:

  • If not running as app, attempt to lock orientation when not full-screen.
    • Unsure how to do this check in mochitest. Not a super-high-value test.

Test App Design

Basic test application can be found here. It surfaces all major bits of the API for interactive testing.


This page is based on the WebAPI Test Plan Template