diff --git a/dev/devicelab/bin/tasks/run_machine_concurrent_hot_reload.dart b/dev/devicelab/bin/tasks/run_machine_concurrent_hot_reload.dart deleted file mode 100644 index e425b07f1a6..00000000000 --- a/dev/devicelab/bin/tasks/run_machine_concurrent_hot_reload.dart +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2014 The Flutter 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 'dart:convert'; -import 'dart:io'; - -import 'package:path/path.dart' as path; -import 'package:vm_service_client/vm_service_client.dart'; - -import 'package:flutter_devicelab/framework/adb.dart'; -import 'package:flutter_devicelab/framework/framework.dart'; -import 'package:flutter_devicelab/framework/utils.dart'; - -void main() { - Map parseFlutterResponse(String line) { - if (line.startsWith('[') && line.endsWith(']')) { - try { - return json.decode(line)[0] as Map; - } catch (e) { - // Not valid JSON, so likely some other output that was surrounded by [brackets] - return null; - } - } - return null; - } - - Stream transformToLines(Stream> byteStream) { - return byteStream.transform(utf8.decoder).transform(const LineSplitter()); - } - - task(() async { - Uri vmServiceUri; - String appId; - - final Device device = await devices.workingDevice; - await device.unlock(); - final Directory appDir = - dir(path.join(flutterDirectory.path, 'dev/integration_tests/ui')); - await inDirectory(appDir, () async { - final Completer ready = Completer(); - bool ok; - print('run: starting...'); - final Process run = await startProcess( - path.join(flutterDirectory.path, 'bin', 'flutter'), - [ - 'run', - '--machine', - '--no-fast-start', - '-d', - device.deviceId, - 'lib/commands.dart', - ], - ); - final StreamController stdout = StreamController.broadcast(); - transformToLines(run.stdout).listen((String line) { - print('run:stdout: $line'); - stdout.add(line); - final dynamic json = parseFlutterResponse(line); - if (json != null) { - if (json['event'] == 'app.debugPort') { - vmServiceUri = Uri.parse(json['params']['wsUri'] as String); - print('service protocol connection available at $vmServiceUri'); - } else if (json['event'] == 'app.started') { - appId = json['params']['appId'] as String; - print('application identifier is $appId'); - } - } - if (vmServiceUri != null && appId != null && !ready.isCompleted) { - print('run: ready!'); - ready.complete(); - ok ??= true; - } - }); - run.exitCode.then((int exitCode) { - ok = false; - }); - await Future.any(>[ready.future, run.exitCode]); - if (!ok) - throw 'Failed to run test app.'; - - final VMServiceClient client = VMServiceClient.connect(vmServiceUri); - - int id = 1; - Future> sendRequest(String method, dynamic params) async { - final int requestId = id++; - final Completer> response = Completer>(); - final StreamSubscription responseSubscription = stdout.stream.listen((String line) { - final Map json = parseFlutterResponse(line); - if (json != null && json['id'] == requestId) - response.complete(json); - }); - final Map req = { - 'id': requestId, - 'method': method, - 'params': params, - }; - final String jsonEncoded = json.encode(>[req]); - print('run:stdin: $jsonEncoded'); - run.stdin.writeln(jsonEncoded); - final Map result = await response.future; - responseSubscription.cancel(); - return result; - } - - print('test: sending two hot reloads...'); - final Future hotReload1 = sendRequest( - 'app.restart', - {'appId': appId, 'fullRestart': false}, - ); - final Future hotReload2 = sendRequest( - 'app.restart', - {'appId': appId, 'fullRestart': false}, - ); - final Future> reloadRequests = Future.wait(>[ - hotReload1, - hotReload2, - ]); - final dynamic results = await Future.any(>[ - run.exitCode, - reloadRequests, - ]); - - if (!ok) - throw 'App failed or crashed during hot reloads.'; - - final List responses = results as List; - final List errorResponses = responses.where( - (dynamic r) => r['error'] != null - ).toList(); - final List successResponses = responses.where( - (dynamic r) => r['error'] == null && - r['result'] != null && - r['result']['code'] == 0 - ).toList(); - - if (errorResponses.length != 1) - throw 'Did not receive the expected (exactly one) hot reload error response.'; - final String errorMessage = (errorResponses.first as Map)['error'] as String; - if (!errorMessage.contains('in progress')) - throw 'Error response was not that hot reload was in progress.'; - if (successResponses.length != 1) - throw 'Did not receive the expected (exactly one) successful hot reload response.'; - - final dynamic hotReload3 = await sendRequest( - 'app.restart', - {'appId': appId, 'fullRestart': false}, - ); - if (hotReload3['error'] != null) - throw 'Received an error response from a hot reload after all other hot reloads had completed.'; - - sendRequest('app.stop', {'appId': appId}); - final int result = await run.exitCode; - if (result != 0) - throw 'Received unexpected exit code $result from run process.'; - print('test: validating that the app has in fact closed...'); - await client.done; - }); - return TaskResult.success(null); - }); -} diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml index 275405f6c69..d384133ff79 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml @@ -346,12 +346,6 @@ tasks: stage: devicelab required_agent_capabilities: ["mac/android"] - run_machine_concurrent_hot_reload: - description: > - Runs tests of concurrent hot reload commands via flutter run --machine. - stage: devicelab - required_agent_capabilities: ["mac/android"] - service_extensions_test: description: > Validates our service protocol extensions.