Roll sync async engine (#18454)

* Roll the engine.

This engine includes a VM that defaults to sync-async.

flutter/engine@c8eeee4 Roll the Dart VM.
This commit is contained in:
Florian Loitsch 2018-06-18 15:17:02 +02:00 committed by GitHub
parent 592c5ba91a
commit bd4cf62821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 14 deletions

View File

@ -1 +1 @@
c3976b3c7183f479717bffed3f640fb92afbd3dc
c8eeee432bb362d657186faa00b3de7c468a9062

View File

@ -43,7 +43,10 @@ Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack:
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:16:9\)
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:77\)
#[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]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>>
^\(elided [0-9]+ .+\)$

View File

@ -14,7 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
Future<Null> guardedHelper(WidgetTester tester) {
return TestAsyncUtils.guard(() async {
await tester.pumpWidget(const Text('Hello'));
await tester.pumpWidget(const Text('Hello', textDirection: TextDirection.ltr));
});
}

View File

@ -0,0 +1,26 @@
// 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<void> changeGreeting() async {
greeting += ' 1';
await new Future<void>.value(null);
greeting += ' 2';
}
test('execution of async method starts synchronously', () async {
expect(greeting, 'hello');
final Future<void> future = changeGreeting();
expect(greeting, 'hello 1');
await future;
expect(greeting, 'hello 1 2');
});
});
}

View File

@ -502,7 +502,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
testZone.runBinary(_runTestBody, testBody, invariantTester)
.whenComplete(testCompletionHandler);
timeout?.catchError(handleUncaughtError);
asyncBarrier(); // When using AutomatedTestWidgetsFlutterBinding, this flushes the microtasks.
return testCompleter.future;
}
@ -532,6 +531,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
}
assert(inTest);
asyncBarrier(); // When using AutomatedTestWidgetsFlutterBinding, this flushes the microtasks.
return null;
}
@ -848,22 +848,23 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
});
return new Future<Null>.microtask(() async {
// testBodyResult is a Future that was created in the Zone of the
// fakeAsync. This means that if we await it here, it will register a
// microtask to handle the future _in the fake async zone_. We avoid this
// by calling '.then' in the current zone. While flushing the microtasks
// of the fake-zone below, the new future will be completed and can then
// be used without fakeAsync.
final Future<Null> resultFuture = testBodyResult.then<Null>((_) {
// Do nothing.
});
// Resolve interplay between fake async and real async calls.
fakeAsync.flushMicrotasks();
while (_pendingAsyncTasks != null) {
await _pendingAsyncTasks.future;
fakeAsync.flushMicrotasks();
}
// If we get here and fakeAsync != _currentFakeAsync, then the test
// probably timed out.
// testBodyResult is a Future that was created in the Zone of the
// fakeAsync. This means that if we await it here, it will register a
// microtask to handle the future _in the fake async zone_. We avoid this
// by returning the wrapped microtask future that we've created _outside_
// the fake async zone.
return testBodyResult;
return resultFuture;
});
}