<!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:
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();
}
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>
<!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:
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>
<!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:
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();
}
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>
<!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:
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>
<!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:
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();
}
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>
<!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:
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>
<!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:
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();
}
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>
<!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:
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>