cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [10/32] spec commit: Removed geolocation tests
Date Thu, 07 Aug 2014 00:53:28 GMT
Removed geolocation tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/08e9b5c4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/08e9b5c4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/08e9b5c4

Branch: refs/heads/master
Commit: 08e9b5c48e102b3ae3f7b8972105f8d1ea28d9be
Parents: 647bdb1
Author: Staci Cooper <smcooper@us.ibm.com>
Authored: Mon Aug 4 11:33:54 2014 -0400
Committer: Staci Cooper <smcooper@us.ibm.com>
Committed: Mon Aug 4 11:33:54 2014 -0400

----------------------------------------------------------------------
 www/autotest/pages/geolocation.html     |  55 ---------
 www/autotest/tests/geolocation.tests.js | 160 ---------------------------
 www/location/index.html                 |  98 ----------------
 www/location/index.js                   | 128 ---------------------
 4 files changed, 441 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/autotest/pages/geolocation.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/geolocation.html b/www/autotest/pages/geolocation.html
deleted file mode 100644
index b7a0698..0000000
--- a/www/autotest/pages/geolocation.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
-
-<head>
-  <title>Cordova: Geolocation API Specs</title>
-
-  <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes,
initial-scale=1.0;" />
-  <!-- Load jasmine -->
-  <link href="../jasmine.css" rel="stylesheet"/>
-  <script type="text/javascript" src="../jasmine.js"></script>
-  <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
-  <script type="text/javascript" src="../html/HtmlReporter.js"></script>
-  <script type="text/javascript" src="../html/ReporterView.js"></script>
-  <script type="text/javascript" src="../html/SpecView.js"></script>
-  <script type="text/javascript" src="../html/SuiteView.js"></script>
-  <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
-  <!-- Source -->
-  <script type="text/javascript" src="../../cordova-incl.js"></script>
-
-  <!-- Load Test Runner -->
-  <script type="text/javascript" src="../test-runner.js"></script>
-
-  <!-- Tests -->
-  <script type="text/javascript" src="../tests/geolocation.tests.js"></script>
-  <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
     
-</head>
-
-<body>
-  <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/autotest/tests/geolocation.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/geolocation.tests.js b/www/autotest/tests/geolocation.tests.js
deleted file mode 100644
index bdb0b53..0000000
--- a/www/autotest/tests/geolocation.tests.js
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe('Geolocation (navigator.geolocation)', function () {
-    it("geolocation.spec.1 should exist", function() {
-        expect(navigator.geolocation).toBeDefined();
-    });
-
-    it("geolocation.spec.2 should contain a getCurrentPosition function", function() {
-        expect(typeof navigator.geolocation.getCurrentPosition).toBeDefined();
-        expect(typeof navigator.geolocation.getCurrentPosition == 'function').toBe(true);
-    });
-
-    it("geolocation.spec.3 should contain a watchPosition function", function() {
-        expect(typeof navigator.geolocation.watchPosition).toBeDefined();
-        expect(typeof navigator.geolocation.watchPosition == 'function').toBe(true);
-    });
-
-    it("geolocation.spec.4 should contain a clearWatch function", function() {
-        expect(typeof navigator.geolocation.clearWatch).toBeDefined();
-        expect(typeof navigator.geolocation.clearWatch == 'function').toBe(true);
-    });
-
-    describe('getCurrentPosition method', function() {
-        // this api requires manual user confirmation on windows8 so skip it
-        if (cordova.platformId == 'windows8') return;
-        
-        describe('error callback', function() {
-            it("geolocation.spec.5 should be called if we set timeout to 0 and maximumAge
to a very small number", function() {
-                console.log("Here I am");
-                var win = jasmine.createSpy(),
-                    fail = jasmine.createSpy();
-
-                runs(function () {
-                    navigator.geolocation.getCurrentPosition(win, fail, {
-                        maximumAge: 0,
-                        timeout: 0
-                    });
-                });
-
-                waitsFor(function () { return fail.wasCalled; }, "fail never called", 250);
//small timeout as this should fire very fast
-
-                runs(function () {
-                    expect(win).not.toHaveBeenCalled();
-                });
-            });
-        });
-
-        describe('success callback', function() {
-            it("geolocation.spec.6 should be called with a Position object", function() {
-                var providerAvailable=true;
-                var win = jasmine.createSpy().andCallFake(function(p) {
-                          expect(p.coords).toBeDefined();
-                          expect(p.timestamp).toBeDefined();
-                      }),
-                      fail = jasmine.createSpy().andCallFake(function(e) {
-                          if(e.code == 2) {
-                              providerAvailable=false;
-                          }
-                      });
-
-                runs(function () {
-                    navigator.geolocation.getCurrentPosition(win, fail, {
-                        maximumAge:300000 // 5 minutes maximum age of cached position
-                    });
-                });
-
-                waitsFor(function () { return (win.wasCalled || fail.wasCalled); }, "win/fail
never called", 20000);
-
-                runs(function () {
-                    if(providerAvailable) {
-                        expect(fail).not.toHaveBeenCalled();
-                    }
-                });
-            });
-        });
-    });
-
-    describe('watchPosition method', function() {
-        // this api requires manual user confirmation on windows8 so skip it
-        if (cordova.platformId == 'windows8') return;
-        
-        describe('error callback', function() {
-            var errorWatch = null;
-
-            afterEach(function() {
-                navigator.geolocation.clearWatch(errorWatch);
-            });
-            it("geolocation.spec.7 should be called if we set timeout to 0 and maximumAge
to a very small number", function() {
-                var win = jasmine.createSpy(),
-                    fail = jasmine.createSpy();
-
-                runs(function () {
-                    errorWatch = navigator.geolocation.watchPosition(win, fail, {
-                        maximumAge: 0,
-                        timeout: 0
-                    });
-                });
-
-                waitsFor(function () { return fail.wasCalled; }, "fail never called", 250);
// small timeout as this should fire very quickly
-
-                runs(function () {
-                    expect(win).not.toHaveBeenCalled();
-                });
-            });
-        });
-
-        describe('success callback', function() {
-            var successWatch = null;
- 
-            afterEach(function() {
-                navigator.geolocation.clearWatch(successWatch);
-            });
-            it("geolocation.spec.8 should be called with a Position object", function() {
-                var providerAvailable=true;
-                var win = jasmine.createSpy().andCallFake(function(p) {
-                          expect(p.coords).toBeDefined();
-                          expect(p.timestamp).toBeDefined();
-                      }),
-                      fail = jasmine.createSpy().andCallFake(function(e) {
-                          if(e.code ==2) {
-                              providerAvailable=false;
-                          }
-                      });
-
-                runs(function () {
-                    successWatch = navigator.geolocation.watchPosition(win, fail, {
-                        maximumAge:(5 * 60 * 1000) // 5 minutes maximum age of cached position
-                    });
-                });
-
-                waitsFor(function () { return (win.wasCalled || fail.wasCalled); }, "win/fail
never called", 20000);
-
-                runs(function () {
-                    if(providerAvailable) {
-                        expect(fail).not.toHaveBeenCalled();
-                    }
-                });
-            });
-        });
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/location/index.html
----------------------------------------------------------------------
diff --git a/www/location/index.html b/www/location/index.html
deleted file mode 100644
index f0cc7de..0000000
--- a/www/location/index.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<html>
-  <head>
-    <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0"
/>
-    <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1
-->
-    <title>Cordova Mobile Spec</title>
-    <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no
title" charset="utf-8">
-    <script type="text/javascript" charset="utf-8" src="../cordova-incl.js"></script>
     
-    <script type="text/javascript" charset="utf-8" src="./index.js"></script>
     
-  </head>
-  <body id="stage" class="theme">
-  
-    <h1>Location</h1>
-    <div id="info">
-        <b>Status:</b> <span id="location_status">Stopped</span>
-        <table width="100%">
-            <tr>
-                <td><b>Latitude:</b></td>
-                <td id="latitude">&nbsp;</td>
-                <td>(decimal degrees) geographic coordinate [<a href="http://dev.w3.org/geo/api/spec-source.html#lat">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Longitude:</b></td>
-                <td id="longitude">&nbsp;</td>
-                <td>(decimal degrees) geographic coordinate [<a href="http://dev.w3.org/geo/api/spec-source.html#lat">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Altitude:</b></td>
-                <td id="altitude">&nbsp;</td>
-                <td>null if not supported;<br>
-                    (meters) height above the [<a href="http://dev.w3.org/geo/api/spec-source.html#ref-wgs">WGS84</a>]
ellipsoid. [<a href="http://dev.w3.org/geo/api/spec-source.html#altitude">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Accuracy:</b></td>
-                <td id="accuracy">&nbsp;</td>
-                <td>(meters; non-negative; 95% confidence level) the accuracy level
of the latitude and longitude coordinates. [<a href="http://dev.w3.org/geo/api/spec-source.html#accuracy">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Heading:</b></td>
-                <td id="heading">&nbsp;</td>
-                <td>null if not supported;<br>
-                    NaN if speed == 0;<br>
-                    (degrees; 0° ≤ heading < 360°) direction of travel of the hosting
device- counting clockwise relative to the true north. [<a href="http://dev.w3.org/geo/api/spec-source.html#heading">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Speed:</b></td>
-                <td id="speed">&nbsp;</td>
-                <td>null if not supported;<br>
-                    (meters per second; non-negative) magnitude of the horizontal component
of the hosting device's current velocity. [<a href="http://dev.w3.org/geo/api/spec-source.html#speed">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Altitude Accuracy:</b></td>
-                <td id="altitude_accuracy">&nbsp;</td>
-                <td>null if not supported;<br>(meters; non-negative; 95% confidence
level) the accuracy level of the altitude. [<a href="http://dev.w3.org/geo/api/spec-source.html#altitude-accuracy">#ref]</a></td>
-            </tr>
-            <tr>
-                <td><b>Time:</b></td>
-                <td id="timestamp">&nbsp;</td>
-                <td>(DOMTimeStamp) when the position was acquired [<a href="http://dev.w3.org/geo/api/spec-source.html#timestamp">#ref]</a></td>
-            </tr>
-        </table>
-    </div>
-    <h2>Action</h2>
-    <h3>Use Built-in WebView navigator.geolocation</h3>
-    <a href="javascript:" class="btn large getWebViewLocation">Get Location</a>
-    <a href="javascript:" class="btn large watchWebViewLocation">Start Watching Location</a>
-    <a href="javascript:" class="btn large stopWebViewLocation">Stop Watching Location</a>
-    <a href="javascript:" class="btn large getWebViewLocation30">Get Location Up to
30 Seconds Old</a>
-    <h3>Use Cordova Geolocation Plugin</h3>
-    <a href="javascript:" class="btn large getLocation">Get Location</a>
-    <a href="javascript:" class="btn large watchLocation">Start Watching Location</a>
-    <a href="javascript:" class="btn large stopLocation">Stop Watching Location</a>
-    <a href="javascript:" class="btn large getLocation30">Get Location Up to 30 Seconds
Old</a>
-    <h2>&nbsp;</h2><a href="javascript:" class="backBtn"">Back</a>
   
-  </body>
-</html>      

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/location/index.js
----------------------------------------------------------------------
diff --git a/www/location/index.js b/www/location/index.js
deleted file mode 100644
index 242919d..0000000
--- a/www/location/index.js
+++ /dev/null
@@ -1,128 +0,0 @@
-var origGeolocation = null;
-var newGeolocation = null;
-
-//-------------------------------------------------------------------------
-// Location
-//-------------------------------------------------------------------------
-var watchLocationId = null;
-
-/**
- * Start watching location
- */
-var watchLocation = function(usePlugin) {
-    var geo = usePlugin ? newGeolocation : origGeolocation;
-    if (!geo) {
-        alert('geolocation object is missing. usePlugin = ' + usePlugin);
-        return;
-    }
-
-    // Success callback
-    var success = function(p){
-          console.log('watch location success');
-          setLocationDetails(p);
-    };
-
-    // Fail callback
-    var fail = function(e){
-        console.log("watchLocation fail callback with error code "+e);
-        stopLocation(geo);
-    };
-
-    // Get location
-    watchLocationId = geo.watchPosition(success, fail, {enableHighAccuracy: true});
-    setLocationStatus("Running");
-};
-
-/**
- * Stop watching the location
- */
-var stopLocation = function(usePlugin) {
-    var geo = usePlugin ? newGeolocation : origGeolocation;
-    if (!geo) {
-        alert('geolocation object is missing. usePlugin = ' + usePlugin);
-        return;
-    }
-    setLocationStatus("Stopped");
-    if (watchLocationId) {
-        geo.clearWatch(watchLocationId);
-        watchLocationId = null;
-    }
-};
-
-/**
- * Get current location
- */
-var getLocation = function(usePlugin, opts) {
-    var geo = usePlugin ? newGeolocation : origGeolocation;
-    if (!geo) {
-        alert('geolocation object is missing. usePlugin = ' + usePlugin);
-        return;
-    }
-
-    // Stop location if running
-    stopLocation(geo);
-
-    // Success callback
-    var success = function(p){
-        console.log('get location success');
-        setLocationDetails(p);
-        setLocationStatus("Done");
-    };
-
-    // Fail callback
-    var fail = function(e){
-        console.log("getLocation fail callback with error code "+e.code);
-        setLocationStatus("Error: "+e.code);
-    };
-
-    setLocationStatus("Retrieving location...");
-
-    // Get location
-    geo.getCurrentPosition(success, fail, opts || {enableHighAccuracy: true}); //, {timeout:
10000});
-
-};
-
-/**
- * Set location status
- */
-var setLocationStatus = function(status) {
-    document.getElementById('location_status').innerHTML = status;
-};
-var setLocationDetails = function(p) {
-var date = (new Date(p.timestamp));
-        document.getElementById('latitude').innerHTML = p.coords.latitude;
-        document.getElementById('longitude').innerHTML = p.coords.longitude;
-        document.getElementById('altitude').innerHTML = p.coords.altitude;
-        document.getElementById('accuracy').innerHTML = p.coords.accuracy;
-        document.getElementById('heading').innerHTML = p.coords.heading;
-        document.getElementById('speed').innerHTML = p.coords.speed;
-        document.getElementById('altitude_accuracy').innerHTML = p.coords.altitudeAccuracy;
-        document.getElementById('timestamp').innerHTML =  date.toDateString() + " " + date.toTimeString();
-}
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
-    document.addEventListener("deviceready", function() {
-        newGeolocation = navigator.geolocation;
-        origGeolocation = cordova.require('cordova/modulemapper').getOriginalSymbol(window,
'navigator.geolocation');
-        if (!origGeolocation) {
-            origGeolocation = newGeolocation;
-            newGeolocation = null;
-        }
-    }, false);
-}
-
-window.onload = function() {
-  addListenerToClass('getWebViewLocation', getLocation, [false]);
-  addListenerToClass('watchWebViewLocation', watchLocation, [false]);
-  addListenerToClass('stopWebViewLocation', stopLocation, [false]);
-  addListenerToClass('getWebViewLocation30', getLocation, [false, {maximumAge:30000}]);
-  addListenerToClass('getLocation', getLocation, [true]);
-  addListenerToClass('watchLocation', watchLocation, [true]);
-  addListenerToClass('stopLocation', stopLocation, [true]);
-  addListenerToClass('getLocation30', getLocation, [true, {maximumAge:30000}]);
-  addListenerToClass('backBtn', backHome);
-  init();
-}


Mime
View raw message