Migrate interactive_geolocation_test to async_minitest

Change-Id: I46ae16ccca91823b68421fd5c067ff68166a7cf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139499
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Srujan Gaddam 2020-03-16 17:48:48 +00:00 committed by commit-bot@chromium.org
parent 47e495a89a
commit 3cbf1f65f3

View file

@ -6,26 +6,27 @@ library interactive_test;
import 'dart:async';
import 'dart:html';
import 'package:unittest/unittest.dart';
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'utils.dart';
main() {
test('getCurrentPosition', () {
return window.navigator.geolocation.getCurrentPosition().then((position) {
expect(position.coords.latitude, isNotNull);
expect(position.coords.longitude, isNotNull);
expect(position.coords.accuracy, isNotNull);
});
});
Future testGetCurrentPosition() async {
var position = await window.navigator.geolocation.getCurrentPosition();
Expect.isNotNull(position.coords.latitude);
Expect.isNotNull(position.coords.longitude);
Expect.isNotNull(position.coords.accuracy);
}
test('watchPosition', () {
return window.navigator.geolocation
.watchPosition()
.first
.then((position) {
expect(position.coords.latitude, isNotNull);
expect(position.coords.longitude, isNotNull);
expect(position.coords.accuracy, isNotNull);
});
Future testWatchPosition() async {
var position = await window.navigator.geolocation.watchPosition().first;
Expect.isNotNull(position.coords.latitude);
Expect.isNotNull(position.coords.longitude);
Expect.isNotNull(position.coords.accuracy);
}
main() {
asyncTest(() async {
await testGetCurrentPosition();
await testWatchPosition();
});
}