Revert "Reland "Make sure all isolates start during flutter driver tests" (#64432)" (#65635)

This reverts commit ccd4f6dd18.
This commit is contained in:
renyou
2020-09-11 17:15:31 -04:00
committed by GitHub
parent 3dfbdac6f4
commit 51bb11f7ce
2 changed files with 60 additions and 111 deletions

View File

@@ -35,7 +35,6 @@ void main() {
MockVM mockVM;
MockIsolate mockIsolate;
MockPeer mockPeer;
MockIsolate otherIsolate;
void expectLogContains(String message) {
expect(log, anyElement(contains(message)));
@@ -46,15 +45,10 @@ void main() {
mockClient = MockVMServiceClient();
mockVM = MockVM();
mockIsolate = MockIsolate();
otherIsolate = MockIsolate();
mockPeer = MockPeer();
when(mockClient.getVM()).thenAnswer((_) => Future<MockVM>.value(mockVM));
when(mockClient.onIsolateRunnable).thenAnswer((Invocation invocation) {
return Stream<VMIsolateRef>.fromIterable(<VMIsolateRef>[otherIsolate]);
});
when(mockVM.isolates).thenReturn(<VMRunnableIsolate>[mockIsolate]);
when(mockIsolate.loadRunnable()).thenAnswer((_) => Future<MockIsolate>.value(mockIsolate));
when(mockIsolate.load()).thenAnswer((_) => Future<MockIsolate>.value(mockIsolate));
when(mockIsolate.extensionRpcs).thenReturn(<String>[]);
when(mockIsolate.onExtensionAdded).thenAnswer((Invocation invocation) {
return Stream<String>.fromIterable(<String>['ext.flutter.driver']);
@@ -66,10 +60,6 @@ void main() {
VMServiceClientConnection(mockClient, mockPeer)
);
};
when(otherIsolate.load()).thenAnswer((_) => Future<MockIsolate>.value(otherIsolate));
when(otherIsolate.resume()).thenAnswer((Invocation invocation) {
return Future<dynamic>.value(null);
});
});
tearDown(() async {
@@ -87,20 +77,15 @@ void main() {
connectionLog.add('resume');
return Future<dynamic>.value(null);
});
when(otherIsolate.pauseEvent).thenReturn(MockVMPauseStartEvent());
when(mockIsolate.onExtensionAdded).thenAnswer((Invocation invocation) {
connectionLog.add('onExtensionAdded');
return Stream<String>.fromIterable(<String>['ext.flutter.driver']);
});
when(otherIsolate.resume()).thenAnswer((Invocation invocation) {
connectionLog.add('other-resume');
return Future<dynamic>.value(null);
});
final FlutterDriver driver = await FlutterDriver.connect(dartVmServiceUrl: '');
expect(driver, isNotNull);
expectLogContains('Attempting to resume isolate');
expect(connectionLog, <String>['streamListen', 'resume', 'other-resume', 'onExtensionAdded']);
expectLogContains('Isolate is paused at start');
expect(connectionLog, <String>['resume', 'streamListen', 'onExtensionAdded']);
});
test('connects to isolate paused mid-flight', () async {
@@ -109,7 +94,7 @@ void main() {
final FlutterDriver driver = await FlutterDriver.connect(dartVmServiceUrl: '');
expect(driver, isNotNull);
expectLogContains('Attempting to resume isolate');
expectLogContains('Isolate is paused mid-flight');
});
// This test simulates a situation when we believe that the isolate is
@@ -175,9 +160,6 @@ void main() {
mockClient = MockVMServiceClient();
mockPeer = MockPeer();
mockIsolate = MockIsolate();
when(mockClient.onIsolateRunnable).thenAnswer((Invocation invocation) {
return Stream<VMIsolateRef>.fromIterable(<VMIsolateRef>[]);
});
driver = VMServiceFlutterDriver.connectedTo(mockClient, mockPeer, mockIsolate);
});
@@ -808,9 +790,6 @@ void main() {
mockClient = MockVMServiceClient();
mockPeer = MockPeer();
mockIsolate = MockIsolate();
when(mockClient.onIsolateRunnable).thenAnswer((Invocation invocation) {
return Stream<VMIsolateRef>.fromIterable(<VMIsolateRef>[]);
});
driver = VMServiceFlutterDriver.connectedTo(mockClient, mockPeer, mockIsolate);
});