Bug 482260 Bustage Fix r=ctalbert
authorClint Talbert <ctalbert@mozilla.com>
Fri, 14 Aug 2009 16:34:40 -0700
changeset 31579 4f1a754a914b23e6928ea1a0d01dea9ad7728ac5
parent 31578 6269562b98ceb15c1169d532e1c5674c6078fb98
child 31580 e1edb1145ba85a1a9ed9cf85c1bd8f38dde25320
push id8592
push userctalbert@mozilla.com
push dateFri, 14 Aug 2009 23:35:15 +0000
treeherdermozilla-central@4f1a754a914b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersctalbert
bugs482260
milestone1.9.3a1pre
Bug 482260 Bustage Fix r=ctalbert
dom/tests/mochitest/geolocation/test_garbageWatch.html
dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html
dom/tests/mochitest/geolocation/test_manyCurrentSerial.html
dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html
dom/tests/mochitest/geolocation/test_manyWatchSerial.html
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_garbageWatch.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+  <title>Test for garbage data returned from location provider </title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=455327">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/** Test for Bug  **/
+
+SimpleTest.waitForExplicitFinish();
+
+start_sending_garbage();
+
+function successCallback(pos){
+  ok(false, "success should have never been called.");
+  stop_sending_garbage();
+  SimpleTest.finish();
+}
+
+function errorCallback(err) {
+  ok(err.code == err.TIMEOUT, "ensure error is a timeout.");
+  stop_sending_garbage();
+  SimpleTest.finish();
+}
+
+
+var options = {
+    maximumAge: 0,
+    timeout: 1000,
+};
+
+navigator.geolocation.watchPosition(successCallback,
+                                    errorCallback,
+                                    options);
+
+setTimeout(clickNotificationButton, 10, kAcceptButton);
+
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyCurrentConcurrent.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+  <title>Test for getCurrentPosition </title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var completeCount = 100;
+
+var hasAccepted = false;
+
+
+function successCallback(position) {
+  check_geolocation(position);
+}
+
+function accept() {
+  hasAccepted = true;
+  clickNotificationButton(kAcceptButton);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// one-shot position requests
+
+var options = {
+    maximumAge: 0,
+};
+
+var y = completeCount;
+for (var x=0; x< y; x++)
+  navigator.geolocation.getCurrentPosition(successCallback, null, options);
+
+setTimeout(accept, 50);
+setTimeout(done, 1000);
+
+function done() {
+  completeCount--;
+  ok(1, "Saw all successCallbacks");
+  SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyCurrentSerial.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+  <title>Test for getCurrentPosition </title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var completeCount = 1000;
+
+var hasAccepted = false;
+
+function successCallback(position) {
+  check_geolocation(position);
+  completeCount--;
+  if (completeCount > 0)   
+    navigator.geolocation.getCurrentPosition(successCallback, null, null);
+  SimpleTest.finish();
+}
+
+function accept() {
+  hasAccepted = true;
+  clickNotificationButton(kAcceptButton);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+var options = {
+    maximumAge: 0,
+};
+
+// one-shot position requests
+navigator.geolocation.getCurrentPosition(successCallback, null, options);
+
+setTimeout(accept, 50);
+
+</script>
+</pre>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWatchConcurrent.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+  <title>Test for watchPosition </title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var completeCount = 100;
+
+var hasAccepted = false;
+
+
+function successCallback(position) {
+  check_geolocation(position);
+}
+
+function accept() {
+  hasAccepted = true;
+  clickNotificationButton(kAcceptButton);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// one-shot position requests
+
+var options = {
+    maximumAge: 0,
+};
+
+var y = completeCount;
+for (var x=0; x< y; x++)
+  navigator.geolocation.watchPosition(successCallback, null, options);
+
+setTimeout(accept, 50);
+setTimeout(done, 1000);
+
+function done() {
+  completeCount--;
+  ok(1, "Saw all successCallbacks");
+  SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/geolocation/test_manyWatchSerial.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482260
+-->
+<head>
+  <title>Test for watchPosition </title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=482260">Mozilla Bug 482260</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var hasAccepted = false;
+var watchID = 0;
+var completeCount = 10;
+
+var options = {
+    maximumAge: 0,
+};
+
+function successCallback(position) {
+  check_geolocation(position);
+
+  navigator.geolocation.clearWatch(watchID);
+
+  completeCount--;
+
+  if (completeCount==0) {
+    ok(1, "all watchPosition successCallbacks called");
+    SimpleTest.finish();
+  } else {
+    watchID = navigator.geolocation.watchPosition(successCallback, null, options);
+    setTimeout(accept, 50);
+  }
+}
+
+function accept() {
+  hasAccepted = true;
+  clickNotificationButton(kAcceptButton);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+// one-shot position requests
+watchID = navigator.geolocation.watchPosition(successCallback, null, options);
+setTimeout(accept, 50);
+
+</script>
+</pre>
+</body>
+</html>
+