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:
@@ -1 +1 @@
|
|||||||
c3976b3c7183f479717bffed3f640fb92afbd3dc
|
c8eeee432bb362d657186faa00b3de7c468a9062
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ Who lives, who dies, who tells your story\?
|
|||||||
|
|
||||||
When the exception was thrown, this was the stack:
|
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: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]+\)
|
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
|
||||||
<<skip until matching line>>
|
<<skip until matching line>>
|
||||||
^\(elided [0-9]+ .+\)$
|
^\(elided [0-9]+ .+\)$
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
|
|||||||
|
|
||||||
Future<Null> guardedHelper(WidgetTester tester) {
|
Future<Null> guardedHelper(WidgetTester tester) {
|
||||||
return TestAsyncUtils.guard(() async {
|
return TestAsyncUtils.guard(() async {
|
||||||
await tester.pumpWidget(const Text('Hello'));
|
await tester.pumpWidget(const Text('Hello', textDirection: TextDirection.ltr));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
packages/flutter/test/engine/dart_test.dart
Normal file
26
packages/flutter/test/engine/dart_test.dart
Normal 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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -502,7 +502,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
|||||||
testZone.runBinary(_runTestBody, testBody, invariantTester)
|
testZone.runBinary(_runTestBody, testBody, invariantTester)
|
||||||
.whenComplete(testCompletionHandler);
|
.whenComplete(testCompletionHandler);
|
||||||
timeout?.catchError(handleUncaughtError);
|
timeout?.catchError(handleUncaughtError);
|
||||||
asyncBarrier(); // When using AutomatedTestWidgetsFlutterBinding, this flushes the microtasks.
|
|
||||||
return testCompleter.future;
|
return testCompleter.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,6 +531,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(inTest);
|
assert(inTest);
|
||||||
|
asyncBarrier(); // When using AutomatedTestWidgetsFlutterBinding, this flushes the microtasks.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,22 +848,23 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return new Future<Null>.microtask(() async {
|
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.
|
// Resolve interplay between fake async and real async calls.
|
||||||
fakeAsync.flushMicrotasks();
|
fakeAsync.flushMicrotasks();
|
||||||
while (_pendingAsyncTasks != null) {
|
while (_pendingAsyncTasks != null) {
|
||||||
await _pendingAsyncTasks.future;
|
await _pendingAsyncTasks.future;
|
||||||
fakeAsync.flushMicrotasks();
|
fakeAsync.flushMicrotasks();
|
||||||
}
|
}
|
||||||
|
return resultFuture;
|
||||||
// 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;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user