gecko/dom/tests/mochitest/geolocation/test_lastPosition.html

90 lines
1.9 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=
-->
<head>
<title>Test for getCurrentPosition </title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="prompt_common.js"></script>
<script type="text/javascript" src="geolocation_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug **/
function handleDialog(doc) {
// Verify the error message is correct - the string (places) is not
// translated
var dialog = doc.getElementById("commonDialog");
var desc = doc.getElementById("info.body");
var errmsg = desc.childNodes[0].data;
ok(errmsg.indexOf("located") > 0, "Check for the correct message");
// Clear the dialog
if (allow_dialog)
dialog.acceptDialog();
else
dialog.cancelDialog();
}
ok(navigator.geolocation, "Ensure that the geolocation object is present");
//first we want to prevent this proprerty from loading.
/*
Moving to the info bar very soon. right now, there is no
dialog in FF.
allow_dialog = 0;
startCallbackTimer();
*/
last = navigator.geolocation.lastPosition;
ok(last == null, "Check to ensure the lastPosition is null");
// Try again, but this time allow the lookup.
/*
Moving to the info bar very soon. right now, there is no
dialog in FF
allow_dialog = 1;
startCallbackTimer();
*/
last = navigator.geolocation.lastPosition;
if (last != null) {
check_geolocation(last);
}
else
{
ok(1, "No geo location available");
}
SimpleTest.finish();
</script>
</pre>
</body>
</html>