From c7ea3ca377e909469c68f2ab878a5bc53d3cf66b Mon Sep 17 00:00:00 2001 From: Mikkel Nygaard Ravn Date: Tue, 29 May 2018 21:07:33 +0200 Subject: [PATCH] Revert sync async (#18002) --- .../exception_handling_expectation.txt | 5 +--- .../test_async_utils_guarded_test.dart | 5 +--- packages/flutter/test/engine/dart_test.dart | 26 ------------------- packages/flutter_test/lib/src/binding.dart | 26 ------------------- packages/flutter_tools/lib/src/compile.dart | 2 -- 5 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 packages/flutter/test/engine/dart_test.dart diff --git a/dev/automated_tests/flutter_test/exception_handling_expectation.txt b/dev/automated_tests/flutter_test/exception_handling_expectation.txt index 346aa983bc..4c0fb6e523 100644 --- a/dev/automated_tests/flutter_test/exception_handling_expectation.txt +++ b/dev/automated_tests/flutter_test/exception_handling_expectation.txt @@ -43,10 +43,7 @@ Who lives, who dies, who tells your story\? When the exception was thrown, this was the stack: #[0-9]+ +main. \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:16:9\) -#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) -#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) -#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) -#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) +#[0-9]+ +main. \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:77\) #[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) <> ^\(elided [0-9]+ .+\)$ diff --git a/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart b/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart index d709a3f0b3..f04a139954 100644 --- a/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart +++ b/dev/automated_tests/flutter_test/test_async_utils_guarded_test.dart @@ -14,10 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding { Future guardedHelper(WidgetTester tester) { return TestAsyncUtils.guard(() async { - await tester.pumpWidget(const Directionality( - textDirection: TextDirection.ltr, - child: const Text('Hello'), - )); + await tester.pumpWidget(const Text('Hello')); }); } diff --git a/packages/flutter/test/engine/dart_test.dart b/packages/flutter/test/engine/dart_test.dart deleted file mode 100644 index 7efe12f9d1..0000000000 --- a/packages/flutter/test/engine/dart_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; - -import 'package:test/test.dart'; - -/// Verifies Dart semantics governed by flags set by Flutter tooling. -void main() { - group('Async', () { - String greeting = 'hello'; - Future changeGreeting() async { - greeting += ' 1'; - await new Future.value(null); - greeting += ' 2'; - } - test('execution of async method starts synchronously', () async { - expect(greeting, 'hello'); - final Future future = changeGreeting(); - expect(greeting, 'hello 1'); - await future; - expect(greeting, 'hello 1 2'); - }); - }); -} diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index d573d82807..9630449ef7 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -490,12 +490,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase } Future _runTestBody(Future testBody(), VoidCallback invariantTester) async { - // Delay this function by a microtask. - // Otherwise it will open a scope immediately, which is then open when - // the `asyncBarrier` is invoked. The `asyncBarrier` is immediately - // following the call to `testZone.runBinary(_runTestBody)`, so delaying - // by one microtask is enough to ensure that the timing is correct. - await new Future.microtask(() {}); assert(inTest); runApp(new Container(key: new UniqueKey(), child: _preTestMessage)); // Reset the tree to a known state. @@ -773,12 +767,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { }); return new Future.microtask(() async { - // Run all queued microtasks. - await new Future.microtask(() {}); - // When the test had an exception, the test-framework already - // ran the teardown functions, removing the _fakeAsync function. - if (_fakeAsync == null) - return null; // Resolve interplay between fake async and real async calls. _fakeAsync.flushMicrotasks(); while (_pendingAsyncTasks != null) { @@ -995,13 +983,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { @override void handleBeginFrame(Duration rawTimeStamp) { - // Don't run this function when `handleBeginFrame` was invoked - // immediately before without a call of `handleDrawFrame` in between. - // TODO(floitsch): Remove this line when the spurious calls from the - // framework don't happen anymore. See - // https://github.com/flutter/flutter/issues/17963 - if (_doDrawThisFrame != null) - return; assert(_doDrawThisFrame == null); if (_expectingFrame || (framePolicy == LiveTestWidgetsFlutterBindingFramePolicy.fullyLive) || @@ -1016,13 +997,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { @override void handleDrawFrame() { - // Don't run this function when `handleBeginFrame` wasn't invoked - // immediately before. - // TODO(floitsch): Remove this line when the spurious calls from the - // framework don't happen anymore. See - // https://github.com/flutter/flutter/issues/17963 - if (_doDrawThisFrame == null) - return; assert(_doDrawThisFrame != null); if (_doDrawThisFrame) super.handleDrawFrame(); diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index 8c204a8734..dc065d6d0c 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -120,7 +120,6 @@ class KernelCompiler { '--sdk-root', sdkRoot, '--strong', - '--sync-async', '--target=flutter', ]; if (trackWidgetCreation) @@ -253,7 +252,6 @@ class ResidentCompiler { _sdkRoot, '--incremental', '--strong', - '--sync-async', '--target=flutter', ]; if (outputPath != null) {