| OLD | NEW |
| 1 description('Tests that when a cached position is available the callback for get
CurrentPosition is called only once. This is a regression test for http://crbug.
com/311876 .'); | 1 description('Tests that when a cached position is available the callback for get
CurrentPosition is called only once. This is a regression test for http://crbug.
com/311876 .'); |
| 2 | 2 |
| 3 if (!window.testRunner || !window.mojo) | |
| 4 debug('This test can not run without testRunner or mojo'); | |
| 5 | |
| 6 // Only one success callback should be reported per call to getCurrentPosition. | 3 // Only one success callback should be reported per call to getCurrentPosition. |
| 7 var reportCount = 0; | 4 var reportCount = 0; |
| 8 var isSuccess; | 5 var isSuccess; |
| 9 | 6 |
| 10 function reportCallback(success, id) { | 7 function reportCallback(success, id) { |
| 11 isSuccess = success; | 8 isSuccess = success; |
| 12 shouldBeTrue('isSuccess'); | 9 shouldBeTrue('isSuccess'); |
| 13 getCurrentPositionCallId = id; | 10 getCurrentPositionCallId = id; |
| 14 shouldBe('getCurrentPositionCallId', 'reportCount'); | 11 shouldBe('getCurrentPositionCallId', 'reportCount'); |
| 15 if (++reportCount >= 3) | 12 if (++reportCount >= 3) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 44 // repeat of the first. | 41 // repeat of the first. |
| 45 getPosition(0); | 42 getPosition(0); |
| 46 getPosition(100); | 43 getPosition(100); |
| 47 getPosition(200); | 44 getPosition(200); |
| 48 }, function(error) { | 45 }, function(error) { |
| 49 testFailed('Error callback invoked unexpectedly'); | 46 testFailed('Error callback invoked unexpectedly'); |
| 50 }); | 47 }); |
| 51 }); | 48 }); |
| 52 | 49 |
| 53 window.jsTestIsAsync = true; | 50 window.jsTestIsAsync = true; |
| OLD | NEW |