@@ -406,6 +406,82 @@ void main() {
406406expect (result, isNull);
407407expect (tester.takeException (), isNotNull);
408408 });
409+
410+ testWidgets ('runs in original zone' , (WidgetTester tester)async {
411+ final Zone testZone= Zone .current;
412+ Zone ? runAsyncZone;
413+ Zone ? timerZone;
414+ Zone ? periodicTimerZone;
415+ Zone ? microtaskZone;
416+
417+ Zone ? innerZone;
418+ Zone ? innerTimerZone;
419+ Zone ? innerPeriodicTimerZone;
420+ Zone ? innerMicrotaskZone;
421+
422+ await tester.binding.runAsync <void >(()async {
423+ final Zone currentZone= Zone .current;
424+ runAsyncZone= currentZone;
425+
426+ // Complete a future when all callbacks have completed.
427+ int pendingCallbacks= 6 ;
428+ final Completer <void > callbacksDone= Completer <void >();
429+ void onCallback () {
430+ if (-- pendingCallbacks== 0 ) {
431+ testZone.run (() {
432+ callbacksDone.complete (null );
433+ });
434+ }
435+ }
436+
437+ // On the runAsync zone itself.
438+ currentZone.createTimer (Duration .zero, () {
439+ timerZone= Zone .current;
440+ onCallback ();
441+ });
442+ currentZone.createPeriodicTimer (Duration .zero, (Timer timer) {
443+ timer.cancel ();
444+ periodicTimerZone= Zone .current;
445+ onCallback ();
446+ });
447+ currentZone.scheduleMicrotask (() {
448+ microtaskZone= Zone .current;
449+ onCallback ();
450+ });
451+
452+ // On a nested user-created zone.
453+ final Zone inner= runZoned (()=> Zone .current);
454+ innerZone= inner;
455+ inner.createTimer (Duration .zero, () {
456+ innerTimerZone= Zone .current;
457+ onCallback ();
458+ });
459+ inner.createPeriodicTimer (Duration .zero, (Timer timer) {
460+ timer.cancel ();
461+ innerPeriodicTimerZone= Zone .current;
462+ onCallback ();
463+ });
464+ inner.scheduleMicrotask (() {
465+ innerMicrotaskZone= Zone .current;
466+ onCallback ();
467+ });
468+
469+ await callbacksDone.future;
470+ });
471+ expect (runAsyncZone, isNotNull);
472+ expect (timerZone,same (runAsyncZone));
473+ expect (periodicTimerZone,same (runAsyncZone));
474+ expect (microtaskZone,same (runAsyncZone));
475+
476+ expect (innerZone, isNotNull);
477+ expect (innerTimerZone,same (innerZone));
478+ expect (innerPeriodicTimerZone,same (innerZone));
479+ expect (innerMicrotaskZone,same (innerZone));
480+
481+ expect (runAsyncZone,isNot (same (testZone)));
482+ expect (runAsyncZone,isNot (same (innerZone)));
483+ expect (innerZone,isNot (same (testZone)));
484+ });
409485 });
410486
411487group ('showKeyboard' , () {