B2G/QA/WebAPI Test Plan/Geolocation

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

Geolocation API Test Plan


Lead Martijn Wargers (irc: mw22)
Contributors Xiao Meng Wei (irc: xwei)
API Description Allows access to the geographical location of the device
API Developer Doug Turner
API Project Page Geolocation
API Tracking Bugs bug 437948
API Status Delivered and ready for test


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


  • Some other areas that could be tested:
    • inside (hidden and multiple) iframes
    • while in the background/background tab
    • on a deleted window/iframe
    • when screen turned off
    • Full screen
    • Private browsing mode
    • related prefs: geolocation.enabled, geo.enabled , browser.geolocation.warning.infoURL , geo.wifi.uri , geo.wifi.access_token. , geo.gps.apn.name , geo.gps.apn.user , geo.gps.apn.password , geo.default.update , geo.gps.supl_server , geo.gps.supl_port , geo.wifi.logging.enabled, geo.wifi.access_token.recycle_interval , geo.prompt.testing, geo.prompt.testing.allow , geo.request.remember.


Geolocation API is defined as part of the nsIDOMNavigator interface. It includes:

  • getCurrentPosition() to get a single position
  • watchPosition() to get an update when the position has changed
  • clearWatch() to clear the listener that is calling when watchPosition()

nsIDOMNavigator (subset)

devmo article

Geolocation API Specification


  • void getCurrentPosition(in nsIDOMGeoPositionCallback successCallback, [optional] in nsIDOMGeoPositionErrorCallback errorCallback, /* GeoPositionOptions */ [optional] in jsval options);
  • long watchPosition(in nsIDOMGeoPositionCallback successCallback, [optional] in nsIDOMGeoPositionErrorCallback errorCallback, /* GeoPositionOptions */ [optional] in jsval options);
  • void clearWatch(in long watchId);



Basic Positive Tests


Sanity Tests

Basic Negative Tests

Test App Design

Basic test application can be found here.


This page is based on the WebAPI Test Plan Template


  • bug 715788 - A-GPS for Gonk, what kind of testing needed for this?
  • UI testing related to the Geolocation API - tbd - john Hammink, Matt Brandt
  • Comments from Kanru for A-GPS testing:
    • I filed https://bugzilla.mozilla.org/show_bug.cgi?id=777983 for writing a Marionette test to test normal GPS on emulator. The emulator could inject fake locations so we could test the basic GPS functionality.
    • But the A-GPS is a bit hard to test because it needs real hardware and server support, and when it fails the GPS engine usually fallback to normal GPS silently. ** Several ways to do automated test that I can think of are (1) extend the emulator to support A-GPS callbacks (2) monitor if the GPS engine is requesting data connection or not (3) use a fake/proxy A-GPS server
    • To turn it on you have to add these prefs:
 pref("geo.gps.supl_server", "supl.google.com");
 pref("geo.gps.supl_port", 7276);
 pref("geo.gps.apn.name", "internet");
 pref("geo.gps.apn.user", "");
 pref("geo.gps.apn.password", "");
    • where the "geo.gps.apn.name" is the APN for data connection.