mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
Fixed failing tests caused by introduction of authentication codes (#31315)
This commit is contained in:
parent
eaf058d81d
commit
1459b1e91f
|
@ -43,10 +43,11 @@ void main() {
|
|||
await device.shellExec('am', <String>['start', '-n', _kActivityId]);
|
||||
final String observatoryLine = await device.adb(<String>['logcat', '-e', 'Observatory listening on http:', '-m', '1', '-T', currentTime]);
|
||||
print('Found observatory line: $observatoryLine');
|
||||
final String observatoryPort = RegExp(r'Observatory listening on http://.*:([0-9]+)').firstMatch(observatoryLine)[1];
|
||||
print('Extracted observatory port: $observatoryPort');
|
||||
final String observatoryUri = RegExp('Observatory listening on ((http|\/\/)[a-zA-Z0-9:/=_\\-\.\\[\\]]+)').firstMatch(observatoryLine)[1];
|
||||
print('Extracted observatory port: $observatoryUri');
|
||||
final Process attachProcess =
|
||||
await _run(device: device, command: <String>['attach', '--debug-port', observatoryPort, '--isolate-filter', '$_kSecondIsolateName'], stdoutListener: (String line) {
|
||||
await _run(device: device, command: <String>['attach', '--debug-uri',
|
||||
observatoryUri, '--isolate-filter', '$_kSecondIsolateName'], stdoutListener: (String line) {
|
||||
if (line.contains(_kFirstIsolateName)) {
|
||||
firstNameFound.complete();
|
||||
} else if (line.contains(_kSecondIsolateName)) {
|
||||
|
|
|
@ -31,7 +31,7 @@ void main() {
|
|||
}
|
||||
|
||||
task(() async {
|
||||
int vmServicePort;
|
||||
Uri vmServiceUri;
|
||||
String appId;
|
||||
|
||||
final Device device = await devices.workingDevice;
|
||||
|
@ -60,14 +60,14 @@ void main() {
|
|||
final dynamic json = parseFlutterResponse(line);
|
||||
if (json != null) {
|
||||
if (json['event'] == 'app.debugPort') {
|
||||
vmServicePort = Uri.parse(json['params']['wsUri']).port;
|
||||
print('service protocol connection available at port $vmServicePort');
|
||||
vmServiceUri = Uri.parse(json['params']['wsUri']);
|
||||
print('service protocol connection available at $vmServiceUri');
|
||||
} else if (json['event'] == 'app.started') {
|
||||
appId = json['params']['appId'];
|
||||
print('application identifier is $appId');
|
||||
}
|
||||
}
|
||||
if (vmServicePort != null && appId != null && !ready.isCompleted) {
|
||||
if (vmServiceUri != null && appId != null && !ready.isCompleted) {
|
||||
print('run: ready!');
|
||||
ready.complete();
|
||||
ok ??= true;
|
||||
|
@ -84,9 +84,7 @@ void main() {
|
|||
if (!ok)
|
||||
throw 'Failed to run test app.';
|
||||
|
||||
final VMServiceClient client = VMServiceClient.connect(
|
||||
'ws://localhost:$vmServicePort/ws'
|
||||
);
|
||||
final VMServiceClient client = VMServiceClient.connect(vmServiceUri);
|
||||
|
||||
int id = 1;
|
||||
Future<Map<String, dynamic>> sendRequest(String method, dynamic params) async {
|
||||
|
|
|
@ -81,7 +81,7 @@ void main() {
|
|||
|
||||
final Future<VMExtensionEvent> navigationFuture = navigationEvents.first;
|
||||
// This tap triggers a navigation event.
|
||||
device.tap(100, 100);
|
||||
device.tap(100, 200);
|
||||
final VMExtensionEvent navigationEvent = await navigationFuture;
|
||||
// Validate that there are not any fields.
|
||||
expect(navigationEvent.data.isEmpty);
|
||||
|
|
|
@ -542,10 +542,11 @@ int parseServicePort(String line, {
|
|||
Pattern prefix,
|
||||
}) {
|
||||
prefix ??= _obsRegExp;
|
||||
final Match prefixMatch = prefix.matchAsPrefix(line);
|
||||
if (prefixMatch == null) {
|
||||
final Iterable<Match> matchesIter = prefix.allMatches(line);
|
||||
if (matchesIter.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
final Match prefixMatch = matchesIter.first;
|
||||
final List<Match> matches =
|
||||
_obsPortRegExp.allMatches(line, prefixMatch.end).toList();
|
||||
return matches.isEmpty ? null : int.parse(matches[0].group(2));
|
||||
|
@ -559,10 +560,11 @@ Uri parseServiceUri(String line, {
|
|||
Pattern prefix,
|
||||
}) {
|
||||
prefix ??= _obsRegExp;
|
||||
final Match prefixMatch = prefix.matchAsPrefix(line);
|
||||
if (prefixMatch == null) {
|
||||
final Iterable<Match> matchesIter = prefix.allMatches(line);
|
||||
if (matchesIter.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
final Match prefixMatch = matchesIter.first;
|
||||
final List<Match> matches =
|
||||
_obsUriRegExp.allMatches(line, prefixMatch.end).toList();
|
||||
return matches.isEmpty ? null : Uri.parse(matches[0].group(0));
|
||||
|
|
|
@ -233,7 +233,7 @@ class AttachCommand extends FlutterCommand {
|
|||
}
|
||||
} else {
|
||||
observatoryUri = await _buildObservatoryUri(device,
|
||||
debugUri?.host ?? hostname, devicePort, debugUri?.path);
|
||||
debugUri?.host ?? hostname, devicePort ?? debugUri.port, debugUri?.path);
|
||||
}
|
||||
try {
|
||||
final bool useHot = getBuildInfo().isDebug;
|
||||
|
|
Loading…
Reference in a new issue