Fix TTS-2051 by updating 8 TCs for Coordinates attributes
authorLiu, Xin <xinx.liu@intel.com>
Tue, 15 Oct 2013 02:16:05 +0000 (10:16 +0800)
committerwanmingx.lin <wanmingx.lin@intel.com>
Tue, 15 Oct 2013 02:25:34 +0000 (10:25 +0800)
Signed-off-by: Liu, Xin <xinx.liu@intel.com>
tct-geoallow-w3c-tests/geoallow/Coordinates_altitudeAccuracy_attribute_empty_string.html
tct-geoallow-w3c-tests/geoallow/Coordinates_altitudeAccuracy_attribute_set_null.html
tct-geoallow-w3c-tests/geoallow/Coordinates_altitude_attribute_empty_string.html
tct-geoallow-w3c-tests/geoallow/Coordinates_altitude_attribute_set_null.html
tct-geoallow-w3c-tests/geoallow/Coordinates_heading_attribute_empty_string.html
tct-geoallow-w3c-tests/geoallow/Coordinates_heading_attribute_set_null.html
tct-geoallow-w3c-tests/geoallow/Coordinates_speed_attribute_empty_string.html
tct-geoallow-w3c-tests/geoallow/Coordinates_speed_attribute_set_null.html

index c5d2195dbf312a6534669b877c9babba3cb06816..e96ff75a15891f36e980dba5a1216e9fd47066a9 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,43 +26,40 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_altitudeAccuracy_attribute_empty_string</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute altitudeAccuracy value of interface Coordinates set empty string" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
     <div id="log"></div>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation() {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute altitudeAccuracy value of interface Coordinates set empty string");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
             }
@@ -70,17 +67,18 @@ Authors:
         function successCallback (position) {
             t.step(function () {
                 position.coords.altitudeAccuracy = "";
-                assert_false(position.coords.altitudeAccuracy == "","Check if the attribute altitudeAccuracy value of interface Coordinates set empty string");
+                //regular matching (e.g. +12.3 -23.63 16.36 1533.6M etc)
+                var reg = new RegExp("^\-*\\+*[0-9]+.*");
+                assert_true(reg.test(position.coords.altitudeAccuracy), "altitudeAccuracy value should be specified in meters");
             });
             t.done();
         }
         function errorCallback (error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
   </body>
 </html>
index 353b158a148c72b0223409a39947e82cb35bc747..9f58965786e97a1868c9a7603dda24daa5141999 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,60 +26,59 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_altitudeAccuracy_attribute_set_null</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute altitudeAccuracy value of interface Coordinates set null" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
   <div id="log"></div>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation() {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute altitudeAccuracy value of interface Coordinates set null");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
             }
         }
         function successCallback(position){
             t.step(function () {
-                assert_true(position.coords.altitudeAccuracy == null,"Check if the attribute altitudeAccuracy value of interface Coordinates set null");
+                position.coords.altitudeAccuracy == null;
+                //regular matching (e.g. +12.3 -23.63 16.36 1533.6M etc)
+                var reg = new RegExp("^\-*\\+*[0-9]+.*");
+                assert_true(reg.test(position.coords.altitudeAccuracy), "altitudeAccuracy value should be specified in meters");
             });
             t.done();
         }
         function errorCallback(error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
   </body>
 </html>
index c867d92e97b8925cb9e6b541c45ff4671a5136bb..4e29dd0c49108c7cf8b553b0d043e05de1677458 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,43 +26,40 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_altitude_attribute_empty_string</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute altitude value of interface Coordinates set empty string" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
     <div id="log"></div>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation() {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute altitude value of interface Coordinates set empty string");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
            }
@@ -70,22 +67,18 @@ Authors:
         function successCallback (position) {
             t.step(function () {
                 position.coords.altitude = "";
-                if(position.coords.altitude == ""){
-                    assert_true(false,"altitude can not be writeable");
-                }else{
-                    assert_true(true,"Check if the attribute altitude value of interface Coordinates set empty string");
-                }
-
+                //regular matching (e.g. +12.3 -23.63 16.36 1533.6M etc)
+                var reg = new RegExp("^\-*\\+*[0-9]+.*");
+                assert_true(reg.test(position.coords.altitude), "altitude value should be specified in meters");
             });
             t.done();
         }
         function errorCallback (error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
   </body>
 </html>
index 29b458b8f460cc3a6e9d76dadbd677cfd8a553e6..54d1613f4525b2d48f5debb18eed84946aef6400 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,59 +26,58 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_altitude_attribute_set_null</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute altitude value of interface Coordinates set null" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation () {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute altitude value of interface Coordinates set null");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
             }
         }
         function successCallback (position) {
             t.step(function () {
-                assert_true(position.coords.altitude == null,"Check if the attribute altitude value of interface Coordinates set null");
+                position.coords.altitude = null;
+                //regular matching (e.g. +12.3 -23.63 16.36 1533.6M etc)
+                var reg = new RegExp("^\-*\\+*[0-9]+.*");
+                assert_true(reg.test(position.coords.altitude), "altitude value should be specified in meters");
             });
             t.done();
         }
         function errorCallback (error) {
             t.step(function () {
-                assert_false(false,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
     <div id="log"></div>
   </body>
index 17e2ddc968a3987851102a0a38aa691600caacc2..c9c00a193d63f4f7968aa2ad58538ec2ece87eb6 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,43 +26,40 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_heading_attribute_empty_string</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute heading value of interface Coordinates set empty string" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
     <div id="log"></div>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation() {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute heading value of interface Coordinates set empty string");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
             }
@@ -70,17 +67,22 @@ Authors:
         function successCallback(position){
             t.step(function () {
                 position.coords.heading = "";
-                assert_false(position.coords.heading == "","Check if the attribute heading value of interface Coordinates set empty string");
+                if (position.coords.speed == 0) {
+                    assert_equals(position.coords.heading, NaN, "the value of the speed attribute is 0, then the value of the heading attribute must be NaN.");
+                } else {
+                    //regular matching (e.g. 0<=reg<360 etc)
+                    var reg = new RegExp("^([0-9]|([1-9][0-9])|([1-3][0-5][0-9])).$");
+                    assert_true(reg.test(position.coords.heading), "the value of the heading attribute is specified in degrees, where 0° ≤ heading < 360°");
+                }
             });
             t.done();
         }
         function  errorCallback(error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
   </body>
 </html>
index acf3c66b77f8d3f953780707e5da196e56417b66..10853a30cdb61339b1ddf5ea057b71068ca1f154 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,59 +26,62 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_heading_attribute_set_null</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute heading value of interface Coordinates set null" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation () {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute heading value of interface Coordinates set null");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
             }
         }
         function successCallback (position) {
             t.step(function () {
-                assert_true(position.coords.heading == null,"Check if the attribute heading value of interface Coordinates set null");
+                position.coords.heading = null;
+                if (position.coords.speed == 0) {
+                    assert_equals(position.coords.heading, NaN, "the value of the speed attribute is 0, then the value of the heading attribute must be NaN.");
+                } else {
+                    //regular matching (e.g. 0<=reg<360 etc)
+                    var reg = new RegExp("^([0-9]|([1-9][0-9])|([1-3][0-5][0-9])).$");
+                    assert_true(reg.test(position.coords.heading), "the value of the heading attribute is specified in degrees, where 0° ≤ heading < 360°");
+                }
             });
             t.done();
         }
         function errorCallback (error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
     <div id="log"></div>
   </body>
index e75af0768d17c855eded33b5c4ffa0814275bd09..5aaff958710b7e7f909a91935ccc5326b1939876 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,43 +26,40 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_speed_attribute_empty_string</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute speed value of interface Coordinates set empty string" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
     <div id="log"></div>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation () {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute speed value of interface Coordinates set empty string");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
             try {
-                navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
             } catch (err) {
                 t.step(function () {
-                    assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                    assert_unreached("Error message: " + err.message);
                 });
                 t.done();
             }
@@ -70,17 +67,18 @@ Authors:
         function successCallback (position) {
             t.step(function () {
                 position.coords.speed = "";
-                assert_false(position.coords.speed == "","Check if the attribute speed value of interface Coordinates set empty string");
+                //regular matching (e.g. 12.56 136.6 421.323m etc)
+                var reg = new RegExp("^[0-9]+.*$");
+                assert_true(reg.test(position.coords.speed), "the attribute speed value is specified in meters per second");
             });
             t.done();
         }
         function errorCallback (error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
   </body>
 </html>
index fddaea2dcef470e33eb1392a66cc917890c0a5af..23404a4aa114591c93c6a54eb46f5bcfed92a461 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-Copyright (c) 2012 Intel Corporation.
+Copyright (c) 2013 Intel Corporation.
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -26,60 +26,59 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Authors:
-        Jin,Weihu <weihux.jin@intel.com>
+        Xinx, liu <xinx.liu@intel.com>
 
 -->
+
 <html>
   <head>
     <title>Geolocation Test:Coordinates_speed_attribute_set_null</title>
-    <link rel="author" title="Intel" href="http://www.intel.com/" />
-    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates" />
-    <meta name="flags" content="interact" />
-    <meta name="assert" content="Check if the attribute speed value of interface Coordinates set null" />
-    <script type="text/javascript" src="../resources/testharness.js"></script>
-    <script type="text/javascript" src="../resources/testharnessreport.js"></script>
-    <script src="../resources/blacklist.js" type="text/javascript"></script>
+    <link rel="author" title="Intel" href="http://www.intel.com/">
+    <link rel="help" href="http://www.w3.org/TR/2012/PR-geolocation-API-20120510/#coordinates">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+    <script src="../resources/blacklist.js"></script>
   </head>
   <body>
   <div id="log"></div>
-    <script type="text/javascript">
-        var t = async_test(document.title);
-        setup({timeout:20000});
-        function showGeolocation () {
-            if (!is_platform_supported("Geolocation")) {
-                try {
-                    navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
-                } catch (err) {
-                    t.step(function () {
-                        assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
-                    });
-                    t.done();
-                }
-                return;
+    <script>
+        var t = async_test("Check if the attribute speed value of interface Coordinates set null");
+        setup({timeout: 20000});
+        if (!is_platform_supported("Geolocation")) {
+            try {
+                navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+            } catch (err) {
+                t.step(function () {
+                    assert_true(err.name == "NOT_SUPPORTED_ERROR", "Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                });
+                t.done();
             }
+        } else {
             //The API is not in blacklist, then do normal tests
               try {
-                  navigator.geolocation.getCurrentPosition(successCallback,errorCallback);
+                  navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
               } catch (err) {
                   t.step(function () {
-                      assert_true(err.name == "NOT_SUPPORTED_ERROR","Mark the case as \"PASS\" because the platform actually doesn't support the interface");
+                      assert_unreached("Error message: " + err.message);
                   });
                   t.done();
               }
         }
         function successCallback (position) {
             t.step(function () {
-                assert_true(position.coords.speed == null,"Check if the attribute speed value of interface Coordinates set null");
+                position.coords.speed = null;
+                //regular matching (e.g. 12.56 136.6 421.323m etc)
+                var reg = new RegExp("^[0-9]+.*$");
+                assert_true(reg.test(position.coords.speed), "the attribute speed value is specified in meters per second");
             });
             t.done();
         }
         function errorCallback (error) {
             t.step(function () {
-                assert_false(true,"This successCallback will be called");
+                assert_unreached("Error message: " + error.message);
             });
             t.done();
         }
-        showGeolocation();
     </script>
   </body>
 </html>