Unverified Commit 7b86be22 authored by Konstantin Scheglov's avatar Konstantin Scheglov Committed by GitHub

Use runZonedGuarded() instead of deprecated onError. (#69160)

parent 55289324
...@@ -305,7 +305,7 @@ void main() { ...@@ -305,7 +305,7 @@ void main() {
final FlutterError error = FlutterError('Oops'); final FlutterError error = FlutterError('Oops');
double errorCount = 0; double errorCount = 0;
runZoned( runZonedGuarded(
() async { () async {
mockHelper.refreshCompleter = Completer<void>.sync(); mockHelper.refreshCompleter = Completer<void>.sync();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -371,7 +371,7 @@ void main() { ...@@ -371,7 +371,7 @@ void main() {
))); )));
expect(mockHelper.invocations, hasLength(5)); expect(mockHelper.invocations, hasLength(5));
}, },
onError: (dynamic e) { (Object e, StackTrace stack) {
expect(e, error); expect(e, error);
expect(errorCount, 0); expect(errorCount, 0);
errorCount++; errorCount++;
......
...@@ -152,7 +152,7 @@ void main() { ...@@ -152,7 +152,7 @@ void main() {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) { await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async { unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>(() => delayedThrow(time)) final Future<void> f = asyncGuard<void>(() => delayedThrow(time))
.catchError((Object e, StackTrace s) { .catchError((Object e, StackTrace s) {
caughtByCatchError = true; caughtByCatchError = true;
...@@ -165,7 +165,7 @@ void main() { ...@@ -165,7 +165,7 @@ void main() {
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
} }
}, onError: (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
...@@ -188,7 +188,7 @@ void main() { ...@@ -188,7 +188,7 @@ void main() {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) { await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async { unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>( final Future<void> f = asyncGuard<void>(
() => delayedThrow(time), () => delayedThrow(time),
onError: (Object e, StackTrace s) { onError: (Object e, StackTrace s) {
...@@ -203,7 +203,7 @@ void main() { ...@@ -203,7 +203,7 @@ void main() {
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
} }
}, onError: (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
...@@ -226,7 +226,7 @@ void main() { ...@@ -226,7 +226,7 @@ void main() {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) { await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async { unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>( final Future<void> f = asyncGuard<void>(
() => delayedThrow(time), () => delayedThrow(time),
onError: (Object e) { onError: (Object e) {
...@@ -241,7 +241,7 @@ void main() { ...@@ -241,7 +241,7 @@ void main() {
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
} }
}, onError: (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
...@@ -265,7 +265,7 @@ void main() { ...@@ -265,7 +265,7 @@ void main() {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) { await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async { unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>( final Future<void> f = asyncGuard<void>(
() => delayedThrow(time), () => delayedThrow(time),
onError: (Object e, [StackTrace s]) { onError: (Object e, [StackTrace s]) {
...@@ -281,7 +281,7 @@ void main() { ...@@ -281,7 +281,7 @@ void main() {
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
} }
}, onError: (Object e, StackTrace s) { }, (Object e, StackTrace s) {
caughtByZone = true; caughtByZone = true;
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.complete(null); completer.complete(null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment