dom/tests/mochitest/chrome/test_geolocation.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/chrome/test_geolocation.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +<!--
     1.8 +  Test for Geolocation in chrome
     1.9 +  -->
    1.10 +<window id="sample-window" width="400" height="400"
    1.11 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.12 +  <script type="application/javascript" 
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    1.14 +
    1.15 +<script>
    1.16 +SimpleTest.waitForExplicitFinish();
    1.17 +
    1.18 +const Ci = Components.interfaces;
    1.19 +const Cc = Components.classes;
    1.20 +
    1.21 +var geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
    1.22 +geolocation.getCurrentPosition(done, error);
    1.23 +
    1.24 +function error(error)
    1.25 +{
    1.26 +  ok(0, "error occured trying to get geolocation from chrome");
    1.27 +  SimpleTest.finish();
    1.28 +}
    1.29 +function done(position)
    1.30 +{
    1.31 +  ok(position, "geolocation was found from chrome");
    1.32 +  SimpleTest.finish();
    1.33 +}
    1.34 +</script>
    1.35 +
    1.36 +<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    1.37 +
    1.38 +</window>

mercurial