Updated Branches: refs/heads/master 2158f8809 -> 141109d9c
Fix flakiness of test.geolocation.js by using waitFor() instead of wait() Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/141109d9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/141109d9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/141109d9 Branch: refs/heads/master Commit: 141109d9cc628c7770f1d64a1df3ceaec21583af Parents: 2158f88 Author: Andrew Grieve <agri...@chromium.org> Authored: Thu Sep 20 23:11:53 2012 -0400 Committer: Andrew Grieve <agri...@chromium.org> Committed: Thu Sep 20 23:11:53 2012 -0400 ---------------------------------------------------------------------- test/test.geolocation.js | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/141109d9/test/test.geolocation.js ---------------------------------------------------------------------- diff --git a/test/test.geolocation.js b/test/test.geolocation.js index 4eef59b..dfd8bdc 100644 --- a/test/test.geolocation.js +++ b/test/test.geolocation.js @@ -100,7 +100,7 @@ describe("geolocation", function () { expect(exec).toHaveBeenCalledWith(jasmine.any(Function), jasmine.any(Function), "Geolocation", "getLocation", [false, 0]); }); - waits(75); + waitsFor(function() { return e.wasCalled; }, 200); runs(function() { expect(e).toHaveBeenCalledWith({ @@ -119,7 +119,7 @@ describe("geolocation", function () { exec.mostRecentCall.args[0]({}); }); - waits(75); + waitsFor(function() { return e.wasCalled || s.wasCalled; }, 200); runs(function() { expect(e).not.toHaveBeenCalled(); @@ -153,7 +153,7 @@ describe("geolocation", function () { exec.mostRecentCall.args[1](eObj); }); - waits(75); + waitsFor(function() { return e.wasCalled; }, 200); runs(function() { expect(e).not.toHaveBeenCalledWith({ @@ -205,7 +205,7 @@ describe("geolocation", function () { runs(function() { geo.watchPosition(s, e); }); - waits(50); + waits(1); runs(function() { exec.mostRecentCall.args[0]({}); // fake success callback from native expect(s).toHaveBeenCalled(); @@ -228,7 +228,7 @@ describe("geolocation", function () { runs(function() { geo.watchPosition(s, e, {timeout:50}); }); - waits(75); + waitsFor(function() { return e.wasCalled; }, 200); runs(function() { expect(e).toHaveBeenCalledWith({ code:PositionError.TIMEOUT, @@ -240,17 +240,17 @@ describe("geolocation", function () { runs(function() { geo.watchPosition(s, e, {timeout:50}); }); - waits(25); + waits(1); runs(function() { exec.mostRecentCall.args[0]({}); // fire new position return expect(s).toHaveBeenCalled(); }); - waits(30); + waits(1); runs(function() { // The error callback should NOT be fired, since the timeout should have reset when we fired a new position return above expect(e).not.toHaveBeenCalled(); }); - waits(25); + waitsFor(function() { return e.wasCalled; }, 200); runs(function() { // NOW the error callback should be fired with a TIMEOUT error expect(e).toHaveBeenCalledWith({