| Index: LayoutTests/dart/dom/GeolocationTest.dart
|
| diff --git a/LayoutTests/dart/dom/GeolocationTest.dart b/LayoutTests/dart/dom/GeolocationTest.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3b5763fc9d3ae9bf59410027c1ea313b5819d8ad
|
| --- /dev/null
|
| +++ b/LayoutTests/dart/dom/GeolocationTest.dart
|
| @@ -0,0 +1,44 @@
|
| +library GeolocationTest;
|
| +
|
| +import 'package:expect/expect.dart';
|
| +import 'package:unittest/html_config.dart';
|
| +import 'package:unittest/unittest.dart';
|
| +import 'dart:async';
|
| +import 'dart:html';
|
| +
|
| +main() {
|
| + useHtmlConfiguration(true);
|
| +
|
| + errorCallback(error) =>
|
| + Expect.fail('${error.error.code}: ${error.error.message}');
|
| +
|
| + // TODO(14150): This delay should not be necessary.
|
| + setUp(() => new Future.delayed(Duration.ZERO));
|
| +
|
| + test('geolocation.getCurrentPosition', () {
|
| + final geolocation = window.navigator.geolocation;
|
| +
|
| + geolocation.getCurrentPosition().then(expectAsync((posA) {
|
| + Timer.run(expectAsync(() {
|
| + geolocation.getCurrentPosition().then(expectAsync((posB) {
|
| + Expect.equals(posA.coords.longitude, posB.coords.longitude);
|
| + })).catchError(errorCallback);
|
| + }));
|
| + })).catchError(errorCallback);
|
| + });
|
| +
|
| + test('geolocation.watchPosition', () {
|
| + final geolocation = window.navigator.geolocation;
|
| +
|
| + var posA;
|
| + return geolocation.getCurrentPosition().then((position) {
|
| + posA = position;
|
| + // TODO(14150): This delay should not be necessary.
|
| + return new Future.delayed(Duration.ZERO);
|
| + }).then((_) {
|
| + return geolocation.watchPosition().first;
|
| + }).then((posB) {
|
| + Expect.equals(posA.coords.longitude, posB.coords.longitude);
|
| + });
|
| + });
|
| +}
|
|
|