You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/07/11 19:23:21 UTC
spec commit: Added more assertions for accelerometer tests. Returned
timestamps should be withi a reasonable range,
not just greater than a recent timestamp.
Updated Branches:
refs/heads/master cb90fb14b -> c7771fb80
Added more assertions for accelerometer tests. Returned timestamps should be withi a reasonable range, not just greater than a recent timestamp.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/c7771fb8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/c7771fb8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/c7771fb8
Branch: refs/heads/master
Commit: c7771fb8061ccd14308089315992a0b350ed5505
Parents: cb90fb1
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Jul 11 10:25:36 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jul 11 10:25:36 2012 -0700
----------------------------------------------------------------------
autotest/tests/accelerometer.tests.js | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/c7771fb8/autotest/tests/accelerometer.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/accelerometer.tests.js b/autotest/tests/accelerometer.tests.js
index e988454..0b61ac3 100644
--- a/autotest/tests/accelerometer.tests.js
+++ b/autotest/tests/accelerometer.tests.js
@@ -59,8 +59,12 @@ describe('Accelerometer (navigator.accelerometer)', function () {
it("success callback Acceleration object should return a recent timestamp", function() {
var veryRecently = (new Date()).getTime();
+ // Need to check that dates returned are not vastly greater than a recent time stamp.
+ // In case the timestamps returned are ridiculously high
+ var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
var win = jasmine.createSpy().andCallFake(function(a) {
expect(a.timestamp).toBeGreaterThan(veryRecently);
+ expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
}),
fail = jasmine.createSpy();
@@ -137,8 +141,12 @@ describe('Accelerometer (navigator.accelerometer)', function () {
it("success callback Acceleration object should return a recent timestamp", function() {
var veryRecently = (new Date()).getTime();
+ // Need to check that dates returned are not vastly greater than a recent time stamp.
+ // In case the timestamps returned are ridiculously high
+ var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
var win = jasmine.createSpy().andCallFake(function(a) {
expect(a.timestamp).toBeGreaterThan(veryRecently);
+ expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
}),
fail = jasmine.createSpy();