Add connectedVmServiceUri service extension and set from flutter_tools (#74534)

* Add connectedVmServiceUri service extension and set from flutter_tools
This commit is contained in:
Kenzie Schmoll
2021-01-25 10:40:14 -08:00
committed by GitHub
parent 2007186d2e
commit c89d649847
14 changed files with 241 additions and 56 deletions

View File

@@ -167,7 +167,7 @@ void main() {
const int disabledExtensions = kIsWeb ? 2 : 0;
// If you add a service extension... TEST IT! :-)
// ...then increment this number.
expect(binding.extensions.length, 30 + widgetInspectorExtensionCount - disabledExtensions);
expect(binding.extensions.length, 31 + widgetInspectorExtensionCount - disabledExtensions);
expect(console, isEmpty);
debugPrint = debugPrintThrottled;
@@ -771,4 +771,17 @@ void main() {
serverAddress = result['value'] as String;
expect(serverAddress, 'http://127.0.0.1:9102');
});
test('Service extensions - connectedVmServiceUri', () async {
Map<String, dynamic> result;
result = await binding.testExtension('connectedVmServiceUri', <String, String>{});
String serverAddress = result['value'] as String;
expect(serverAddress, '');
result = await binding.testExtension('connectedVmServiceUri', <String, String>{'value': 'http://127.0.0.1:54669/kMUMseKAnog=/'});
serverAddress = result['value'] as String;
expect(serverAddress, 'http://127.0.0.1:54669/kMUMseKAnog=/');
result = await binding.testExtension('connectedVmServiceUri', <String, String>{'value': 'http://127.0.0.1:54000/kMUMseKAnog=/'});
serverAddress = result['value'] as String;
expect(serverAddress, 'http://127.0.0.1:54000/kMUMseKAnog=/');
});
}

View File

@@ -2827,11 +2827,9 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
test('devToolsInspectorUri test', () {
activeDevToolsServerAddress = 'http://127.0.0.1:9100';
connectedVmServiceUri = 'http://127.0.0.1:55269/798ay5al_FM=/';
expect(
WidgetInspectorService.instance.devToolsInspectorUri(
Uri.parse('http://127.0.0.1:55269/798ay5al_FM=/'),
'inspector-0',
),
WidgetInspectorService.instance.devToolsInspectorUri('inspector-0'),
equals('http://127.0.0.1:9100/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A55269%2F798ay5al_FM%3D%2F&inspectorRef=inspector-0'),
);
});
@@ -2840,11 +2838,11 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final DevToolsDeepLinkProperty node =
DevToolsDeepLinkProperty(
'description of the deep link',
'the-deep-link',
'http://the-deeplink/',
);
expect(node.toString(), equals('description of the deep link'));
expect(node.name, isEmpty);
expect(node.value, equals('the-deep-link'));
expect(node.value, equals('http://the-deeplink/'));
expect(
node.toJsonMap(const DiagnosticsSerializationDelegate()),
equals(<String, dynamic>{
@@ -2856,7 +2854,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
'missingIfNull': false,
'propertyType': 'String',
'defaultLevel': 'info',
'value': 'the-deep-link',
'value': 'http://the-deeplink/',
}),
);
});