incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject spec commit: Added more assertions for accelerometer tests. Returned timestamps should be withi a reasonable range, not just greater than a recent timestamp.
Date Wed, 11 Jul 2012 17:23:21 GMT
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 <maj.fil@gmail.com>
Authored: Wed Jul 11 10:25:36 2012 -0700
Committer: Fil Maj <maj.fil@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();
 


Mime
View raw message