Migrate events_test to async_minitest

Change-Id: I994d376d3a6a86be989130104fabdc6d217fc0e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139492
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 c27af75504
commit 739e79e863

View file

@ -6,16 +6,8 @@ library tests.html.events_test;
import 'dart:async';
import 'dart:html';
import 'package:unittest/unittest.dart';
import 'package:unittest/src/expected_function.dart' show ExpectedFunction;
T Function() expectAsync0<T>(T Function() callback,
{int count: 1, int max: 0}) =>
new ExpectedFunction<T>(callback, count, max).max0;
T Function(A) expectAsync1<T, A>(T Function(A) callback,
{int count: 1, int max: 0}) =>
new ExpectedFunction<T>(callback, count, max).max1;
import 'package:async_helper/async_minitest.dart';
import 'package:expect/expect.dart';
main() {
test('TimeStamp', () {
@ -55,7 +47,7 @@ main() {
invocationCounter = 0;
element.dispatchEvent(event);
expect(invocationCounter, isZero);
expect(invocationCounter, 0);
var provider = new EventStreamProvider<Event>('test');
@ -67,7 +59,7 @@ main() {
sub.cancel();
invocationCounter = 0;
element.dispatchEvent(event);
expect(invocationCounter, isZero);
expect(invocationCounter, 0);
provider.forTarget(element).listen(handler);
invocationCounter = 0;
@ -105,7 +97,7 @@ main() {
// rely on this. We therefore wrap it into an expectAsync.
runZoned(expectAsync0(() {
var zone = Zone.current;
expect(zone, isNot(equals(Zone.root)));
Expect.notEquals(zone, Zone.root);
StreamSubscription<Event> sub;