OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 var position_1 = 0; | 4 var position_1 = 0; |
5 var position_2 = 0; | 5 var position_2 = 0; |
6 var watch_1_id = 0; | 6 var watch_1_id = 0; |
7 var watch_2_id = 0; | 7 var watch_2_id = 0; |
8 var last_error = 0; | 8 var last_error = 0; |
9 var expected_final_position_latitude = 0; | 9 var expected_final_position_latitude = 0; |
10 var expected_final_position_longitude = 0; | 10 var expected_final_position_longitude = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
25 position_1.coords.longitude != position_2.coords.longitude) { | 25 position_1.coords.longitude != position_2.coords.longitude) { |
26 last_error = "TEST FAIL: watches received different locations. " + | 26 last_error = "TEST FAIL: watches received different locations. " + |
27 " Watch 1 (" + watch_1_id + ") got " + position_1 + | 27 " Watch 1 (" + watch_1_id + ") got " + position_1 + |
28 " Watch 2 (" + watch_2_id + ") got " + position_2; | 28 " Watch 2 (" + watch_2_id + ") got " + position_2; |
29 sendString(last_error); | 29 sendString(last_error); |
30 return; | 30 return; |
31 } | 31 } |
32 sendString('request-callback-success'); | 32 sendString('request-callback-success'); |
33 } | 33 } |
34 | 34 |
35 function checkIfGeopositionUpdated() { | |
36 if (position_updated) | |
37 sendString('geoposition-updated'); | |
38 } | |
39 | |
40 // This will be triggered twice: | 35 // This will be triggered twice: |
41 // 1. When the permission request is approved, it will receive an initial | 36 // 1. When the permission request is approved, it will receive an initial |
42 // value. At this point, the callback does not directly notify success | 37 // value. At this point, the callback does not directly notify success |
43 // because success won't be complete until both callbacks are invoked. | 38 // because success won't be complete until both callbacks are invoked. |
44 // 2. When a new geolocation value is supplied. | 39 // 2. When a new geolocation value is supplied. |
45 function geoSuccessCallback1(position) { | 40 function geoSuccessCallback1(position) { |
46 position_1 = position; | 41 position_1 = position; |
47 if (!first_position_received) { | 42 if (!first_position_received) { |
48 possiblyNotifyFirstPositionReceived(); | 43 possiblyNotifyFirstPositionReceived(); |
49 return; | 44 return; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 expected_final_position_longitude = longitude; | 91 expected_final_position_longitude = longitude; |
97 return 'ok'; | 92 return 'ok'; |
98 } | 93 } |
99 </script> | 94 </script> |
100 </head> | 95 </head> |
101 <body> | 96 <body> |
102 <input type="button" value="manual" onclick="geoStart()"/> | 97 <input type="button" value="manual" onclick="geoStart()"/> |
103 </body> | 98 </body> |
104 </html> | 99 </html> |
105 | 100 |
OLD | NEW |