Revert "Reland "Add support for Dart Development Service (DDS) in Flutter Tools (#61276)" (#61882)" (#61909)

This reverts commit 895b7ef6fa.
This commit is contained in:
Ben Konyi
2020-07-20 16:41:01 -07:00
committed by GitHub
parent 895b7ef6fa
commit 4867f5931f
31 changed files with 50 additions and 229 deletions

View File

@@ -7,7 +7,6 @@ import 'dart:io';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/dds.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
@@ -72,7 +71,6 @@ void main() {
FakeDeviceLogReader mockLogReader;
MockPortForwarder portForwarder;
MockDartDevelopmentService mockDds;
MockAndroidDevice device;
MockHttpClient httpClient;
@@ -80,7 +78,6 @@ void main() {
mockLogReader = FakeDeviceLogReader();
portForwarder = MockPortForwarder();
device = MockAndroidDevice();
mockDds = MockDartDevelopmentService();
when(device.portForwarder)
.thenReturn(portForwarder);
when(portForwarder.forward(devicePort, hostPort: anyNamed('hostPort')))
@@ -89,8 +86,6 @@ void main() {
.thenReturn(<ForwardedPort>[ForwardedPort(hostPort, devicePort)]);
when(portForwarder.unforward(any))
.thenAnswer((_) async {});
when(device.dds).thenReturn(mockDds);
when(mockDds.startDartDevelopmentService(any, false)).thenReturn(null);
final HttpClientRequest httpClientRequest = MockHttpClientRequest();
httpClient = MockHttpClient();
@@ -291,14 +286,11 @@ void main() {
const int hostPort = 42;
final FakeDeviceLogReader mockLogReader = FakeDeviceLogReader();
final MockPortForwarder portForwarder = MockPortForwarder();
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
final MockAndroidDevice device = MockAndroidDevice();
final MockHotRunner mockHotRunner = MockHotRunner();
final MockHotRunnerFactory mockHotRunnerFactory = MockHotRunnerFactory();
when(device.portForwarder)
.thenReturn(portForwarder);
when(device.dds)
.thenReturn(mockDds);
when(portForwarder.forward(devicePort, hostPort: anyNamed('hostPort')))
.thenAnswer((_) async => hostPort);
when(portForwarder.forwardedPorts)
@@ -317,7 +309,6 @@ void main() {
)).thenReturn(mockHotRunner);
when(mockHotRunner.exited).thenReturn(false);
when(mockHotRunner.isWaitingForObservatory).thenReturn(false);
when(mockDds.startDartDevelopmentService(any, false)).thenReturn(null);
testDeviceManager.addDevice(device);
when(device.getLogReader(includePastLogs: anyNamed('includePastLogs')))
@@ -368,14 +359,10 @@ void main() {
const int hostPort = 42;
final FakeDeviceLogReader mockLogReader = FakeDeviceLogReader();
final MockPortForwarder portForwarder = MockPortForwarder();
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
final MockIOSDevice device = MockIOSDevice();
final MockHotRunner mockHotRunner = MockHotRunner();
final MockHotRunnerFactory mockHotRunnerFactory = MockHotRunnerFactory();
when(device.portForwarder)
.thenReturn(portForwarder);
when(device.dds)
.thenReturn(mockDds);
when(device.portForwarder).thenReturn(portForwarder);
when(device.getLogReader(includePastLogs: anyNamed('includePastLogs')))
.thenAnswer((_) => mockLogReader);
when(portForwarder.forward(devicePort, hostPort: anyNamed('hostPort')))
@@ -396,7 +383,6 @@ void main() {
)).thenReturn(mockHotRunner);
when(mockHotRunner.exited).thenReturn(false);
when(mockHotRunner.isWaitingForObservatory).thenReturn(false);
when(mockDds.startDartDevelopmentService(any, false)).thenReturn(null);
testDeviceManager.addDevice(device);
@@ -429,7 +415,6 @@ void main() {
setUp(() {
portForwarder = MockPortForwarder();
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
device = MockAndroidDevice();
when(device.portForwarder)
@@ -440,10 +425,6 @@ void main() {
.thenReturn(<ForwardedPort>[ForwardedPort(hostPort, devicePort)]);
when(portForwarder.unforward(any))
.thenAnswer((_) async {});
when(device.dds)
.thenReturn(mockDds);
when(mockDds.startDartDevelopmentService(any, any))
.thenReturn(null);
});
testUsingContext('succeeds in ipv4 mode', () async {
@@ -814,7 +795,6 @@ class TestHotRunnerFactory extends HotRunnerFactory {
}
}
class MockDartDevelopmentService extends Mock implements DartDevelopmentService {}
class MockProcessManager extends Mock implements ProcessManager {}
class MockProcess extends Mock implements Process {}
class MockHttpClientRequest extends Mock implements HttpClientRequest {}

View File

@@ -8,7 +8,6 @@ import 'package:file/memory.dart';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/android/android_device.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/dds.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/platform.dart';
@@ -68,12 +67,6 @@ void main() {
tryToDelete(tempDir);
});
void applyDdsMocks(Device device) {
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
when(device.dds).thenReturn(mockDds);
when(mockDds.startDartDevelopmentService(any, any)).thenReturn(null);
}
testUsingContext('returns 1 when test file is not found', () async {
testDeviceManager.addDevice(MockDevice());
@@ -195,9 +188,7 @@ void main() {
});
testUsingContext('returns 0 when test ends successfully', () async {
final MockAndroidDevice mockDevice = MockAndroidDevice();
applyDdsMocks(mockDevice);
testDeviceManager.addDevice(mockDevice);
testDeviceManager.addDevice(MockAndroidDevice());
final String testApp = globals.fs.path.join(tempDir.path, 'test', 'e2e.dart');
final String testFile = globals.fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart');
@@ -235,9 +226,7 @@ void main() {
});
testUsingContext('returns exitCode set by test runner', () async {
final MockDevice mockDevice = MockDevice();
applyDdsMocks(mockDevice);
testDeviceManager.addDevice(mockDevice);
testDeviceManager.addDevice(MockDevice());
final String testApp = globals.fs.path.join(tempDir.path, 'test', 'e2e.dart');
final String testFile = globals.fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart');
@@ -384,7 +373,6 @@ void main() {
Future<Device> appStarterSetup() async {
final Device mockDevice = MockDevice();
applyDdsMocks(mockDevice);
testDeviceManager.addDevice(mockDevice);
final FakeDeviceLogReader mockDeviceLogReader = FakeDeviceLogReader();
@@ -520,7 +508,6 @@ void main() {
Future<Device> appStarterSetup() async {
final Device mockDevice = MockDevice();
applyDdsMocks(mockDevice);
testDeviceManager.addDevice(mockDevice);
final FakeDeviceLogReader mockDeviceLogReader = FakeDeviceLogReader();
@@ -804,5 +791,5 @@ class MockDevice extends Mock implements Device {
}
class MockAndroidDevice extends Mock implements AndroidDevice { }
class MockDartDevelopmentService extends Mock implements DartDevelopmentService { }
class MockLaunchResult extends Mock implements LaunchResult { }

View File

@@ -139,8 +139,6 @@ class TestFlutterDevice extends FlutterDevice {
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
bool disableDds = false,
bool ipv6 = false,
}) async {
throw exception;
}

View File

@@ -728,7 +728,6 @@ void main() {
fuchsiaDevice,
expectedIsolateName,
(Uri uri) async => fakeVmServiceHost.vmService,
(Device device, Uri uri) => null,
true, // only poll once.
);

View File

@@ -578,8 +578,6 @@ class TestFlutterDevice extends FlutterDevice {
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
bool disableDds = false,
bool ipv6 = false,
}) async {
throw exception;
}

View File

@@ -61,7 +61,7 @@ void main() {
expect(await fallbackDiscovery.discover(
assumedDevicePort: 23,
device: null,
deivce: null,
hostVmservicePort: 1,
packageId: null,
usesIpv6: false,
@@ -86,7 +86,7 @@ void main() {
});
expect(await fallbackDiscovery.discover(
assumedDevicePort: 23,
device: null,
deivce: null,
hostVmservicePort: 1,
packageId: null,
usesIpv6: false,
@@ -117,7 +117,7 @@ void main() {
expect(await fallbackDiscovery.discover(
assumedDevicePort: 23,
device: null,
deivce: null,
hostVmservicePort: 1,
packageId: 'hello',
usesIpv6: false,
@@ -139,7 +139,7 @@ void main() {
expect(await fallbackDiscovery.discover(
assumedDevicePort: 23,
device: null,
deivce: null,
hostVmservicePort: 1,
packageId: 'hello',
usesIpv6: false,
@@ -161,7 +161,7 @@ void main() {
expect(await fallbackDiscovery.discover(
assumedDevicePort: 23,
device: null,
deivce: null,
hostVmservicePort: 1,
packageId: 'hello',
usesIpv6: false,

View File

@@ -4,7 +4,6 @@
import 'dart:async';
import 'package:flutter_tools/src/base/dds.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/widget_cache.dart';
@@ -1954,11 +1953,8 @@ void main() {
testUsingContext('connect sets up log reader', () => testbed.run(() async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
final MockDevice mockDevice = MockDevice();
final MockDartDevelopmentService mockDds = MockDartDevelopmentService();
final MockDeviceLogReader mockLogReader = MockDeviceLogReader();
when(mockDevice.getLogReader(app: anyNamed('app'))).thenReturn(mockLogReader);
when(mockDevice.dds).thenReturn(mockDds);
when(mockDds.startDartDevelopmentService(any, any)).thenReturn(null);
final TestFlutterDevice flutterDevice = TestFlutterDevice(
mockDevice,
@@ -1990,7 +1986,6 @@ void main() {
}
class MockFlutterDevice extends Mock implements FlutterDevice {}
class MockDartDevelopmentService extends Mock implements DartDevelopmentService {}
class MockVMService extends Mock implements vm_service.VmService {}
class MockDevFS extends Mock implements DevFS {}
class MockDevice extends Mock implements Device {}
@@ -2043,8 +2038,6 @@ class FakeFlutterDevice extends FlutterDevice {
Future<void> connect({
ReloadSources reloadSources,
Restart restart,
bool disableDds = false,
bool ipv6 = false,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,

View File

@@ -21,14 +21,7 @@ void main() {
tempDir = createResolvedTempDirectorySync('attach_test.');
await _project.setUpIn(tempDir);
_flutterRun = FlutterRunTestDriver(tempDir, logPrefix: ' RUN ');
_flutterAttach = FlutterRunTestDriver(
tempDir,
logPrefix: 'ATTACH ',
// Only one DDS instance can be connected to the VM service at a time.
// DDS can also only initialize if the VM service doesn't have any existing
// clients, so we'll just let _flutterRun be responsible for spawning DDS.
spawnDdsInstance: false,
);
_flutterAttach = FlutterRunTestDriver(tempDir, logPrefix: 'ATTACH ');
});
tearDown(() async {
@@ -65,11 +58,7 @@ void main() {
await _flutterRun.run(withDebugger: true);
await _flutterAttach.attach(_flutterRun.vmServicePort);
await _flutterAttach.quit();
_flutterAttach = FlutterRunTestDriver(
tempDir,
logPrefix: 'ATTACH-2',
spawnDdsInstance: false,
);
_flutterAttach = FlutterRunTestDriver(tempDir, logPrefix: 'ATTACH-2');
await _flutterAttach.attach(_flutterRun.vmServicePort);
await _flutterAttach.hotReload();
});

View File

@@ -30,6 +30,7 @@ void main() {
});
tearDown(() async {
await _flutter.stop();
tryToDelete(tempDir);
});
@@ -100,6 +101,7 @@ void main() {
// We don't expect to see any output but want to write to stdout anyway.
completer.complete();
});
await _flutter.stop();
expect(stdout.toString(), isNot(contains(_exceptionStart)));
@@ -116,6 +118,7 @@ void main() {
machine: false,
);
await _flutter.resume();
final Completer<void> completer = Completer<void>();
bool lineFound = false;

View File

@@ -428,7 +428,6 @@ class FlutterRunTestDriver extends FlutterTestDriver {
FlutterRunTestDriver(
Directory projectFolder, {
String logPrefix,
this.spawnDdsInstance = true,
}) : super(projectFolder, logPrefix: logPrefix);
String _currentRunningAppId;
@@ -450,7 +449,6 @@ class FlutterRunTestDriver extends FlutterTestDriver {
if (!chrome)
'--disable-service-auth-codes',
if (machine) '--machine',
if (!spawnDdsInstance) '--disable-dds',
'-d',
if (chrome)
...<String>[
@@ -482,8 +480,6 @@ class FlutterRunTestDriver extends FlutterTestDriver {
<String>[
'attach',
'--machine',
if (!spawnDdsInstance)
'--disable-dds',
'-d',
'flutter-tester',
'--debug-port',
@@ -686,8 +682,6 @@ class FlutterRunTestDriver extends FlutterTestDriver {
void _throwErrorResponse(String message) {
throw '$message\n\n$_lastResponse\n\n${_errorBuffer.toString()}'.trim();
}
final bool spawnDdsInstance;
}
class FlutterTestTestDriver extends FlutterTestDriver {

View File

@@ -39,15 +39,6 @@ void main() {
tryToDelete(tempDir);
});
test('getSupportedProtocols includes DDS', () async {
final ProtocolList protocolList =
await vmService.getSupportedProtocols();
expect(protocolList.protocols, hasLength(2));
for (final Protocol protocol in protocolList.protocols) {
expect(protocol.protocolName, anyOf('VM Service', 'DDS'));
}
});
test('flutterVersion can be called', () async {
final Response response =
await vmService.callServiceExtension('s0.flutterVersion');