3 Copyright (c) 2012 Intel Corporation.
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
8 * Redistributions of works must retain the original copyright notice, this list
9 of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the original copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 may be used to endorse or promote products derived from this work without
15 specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 Jin,Weihu <weihux.jin@intel.com>
34 <title>Geolocation Test:Geolocation_watchPosition_PositionOptions_timeout_0_maximumAge_0</title>
35 <link rel="author" title="Intel" href="http://www.intel.com/" />
36 <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#geolocation" />
37 <meta name="assert" content="watchPosition - should be triggered when timeout is 0 and maximumAge is 0" />
38 <script src="../resources/testharness.js"></script>
39 <script src="../resources/testharnessreport.js"></script>
40 <script src="testinterface.js"></script>
47 var t = async_test(document.title);
48 setup({timeout: 60000});
51 if(!check("geolocation", navigator)) {
53 assert_unreach("navigator.geolocation missing, test failed");
56 navigator.geolocation.watchPosition(successCallback, errorCallback, { timeout: 0, maximumAge: 0 });
60 assert_unreached("Error message: {" + err.message + " }");
64 function successCallback(position) {
68 function errorCallback(error) {
72 } else if (error.code == 1) { // PERMISSION_DENIED
73 msg = "The user rejects the browser requests";
74 } else if (error.code == 2) { //POSITION_UNAVAILABLE
75 msg = "Cannot find your location. Make sure your networkconnection is active and click the link to try again.";
76 } else if (error.code == 3) { //TIMEOUT
81 assert_unreached("PositionErrorCallback handle Event is triggered with the exception of "+ msg.toString());