[VM/Service] Move test logic of http_get_isolate_rpc_test from testee to main process
Issue: https://github.com/dart-lang/sdk/issues/60165
Change-Id: Ic393518dd2b85aa0e5385745bf19591f747791c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411420
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
diff --git a/pkg/vm_service/test/http_invocations/http_auth_get_isolate_rpc_test.dart b/pkg/vm_service/test/http_invocations/http_auth_get_isolate_rpc_test.dart
index 2c59abc..ab50464 100644
--- a/pkg/vm_service/test/http_invocations/http_auth_get_isolate_rpc_test.dart
+++ b/pkg/vm_service/test/http_invocations/http_auth_get_isolate_rpc_test.dart
@@ -7,7 +7,6 @@
void main([args = const <String>[]]) => runIsolateTests(
args,
- tests,
+ httpGetIsolateRpcTests,
'http_auth_get_isolate_rpc_test.dart',
- testeeBefore: testeeBefore,
);
diff --git a/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_common.dart b/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_common.dart
index aba91bd..4bff279 100644
--- a/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_common.dart
+++ b/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_common.dart
@@ -10,7 +10,7 @@
import '../common/service_test_common.dart';
import 'http_request_helpers.dart';
-Future<String> getIsolateId(Uri serverUri) async {
+Future<String> _getIsolateId(Uri serverUri) async {
final result = await makeHttpServiceRequest(
serverUri: serverUri,
method: 'getVM',
@@ -18,46 +18,41 @@
return result['isolates'][0]['id'] as String;
}
-Future<void> testeeBefore() async {
- final info = await waitForServiceInfo();
- final serverUri = info.serverUri!;
-
- try {
- // Build the request.
- final params = <String, String>{
- 'isolateId': await getIsolateId(serverUri),
- };
-
- final result = createServiceObject(
- await makeHttpServiceRequest(
- serverUri: serverUri,
- method: 'getIsolate',
- params: params,
- ),
- ['Isolate'],
- )! as Isolate;
- Expect.isTrue(result.id!.startsWith('isolates/'));
- Expect.isNotNull(result.number);
- Expect.equals(result.json!['_originNumber'], result.number);
- Expect.isTrue(result.startTime! > 0);
- Expect.isTrue(result.livePorts! > 0);
- Expect.isFalse(result.pauseOnExit);
- Expect.isNotNull(result.pauseEvent);
- Expect.isNull(result.error);
- Expect.isNotNull(result.rootLib);
- Expect.isTrue(result.libraries!.isNotEmpty);
- Expect.isTrue(result.breakpoints!.isEmpty);
- Expect.equals(result.json!['_heaps']['new']['type'], 'HeapSpace');
- Expect.equals(result.json!['_heaps']['old']['type'], 'HeapSpace');
- Expect.equals(result.json!['isolate_group']['type'], '@IsolateGroup');
- } catch (e) {
- Expect.fail('invalid request: $e');
- }
-}
-
-final tests = <IsolateTest>[
+final httpGetIsolateRpcTests = <IsolateTest>[
(VmService service, IsolateRef isolateRef) async {
- // Just getting here means that the testee enabled the service protocol
- // web server.
- }
+ final wsUri = Uri.parse(service.wsUri!);
+ final serverUri = Uri.parse('http://${wsUri.authority}');
+
+ try {
+ // Build the request.
+ final params = <String, String>{
+ 'isolateId': await _getIsolateId(serverUri),
+ };
+
+ final result = createServiceObject(
+ await makeHttpServiceRequest(
+ serverUri: serverUri,
+ method: 'getIsolate',
+ params: params,
+ ),
+ ['Isolate'],
+ )! as Isolate;
+ Expect.isTrue(result.id!.startsWith('isolates/'));
+ Expect.isNotNull(result.number);
+ Expect.equals(result.json!['_originNumber'], result.number);
+ Expect.isTrue(result.startTime! > 0);
+ Expect.isTrue(result.livePorts! > 0);
+ Expect.isFalse(result.pauseOnExit);
+ Expect.isNotNull(result.pauseEvent);
+ Expect.isNull(result.error);
+ Expect.isNotNull(result.rootLib);
+ Expect.isTrue(result.libraries!.isNotEmpty);
+ Expect.isTrue(result.breakpoints!.isEmpty);
+ Expect.equals(result.json!['_heaps']['new']['type'], 'HeapSpace');
+ Expect.equals(result.json!['_heaps']['old']['type'], 'HeapSpace');
+ Expect.equals(result.json!['isolate_group']['type'], '@IsolateGroup');
+ } catch (e) {
+ Expect.fail('invalid request: $e');
+ }
+ },
];
diff --git a/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_test.dart b/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_test.dart
index fb6782e..07dd86d 100644
--- a/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_test.dart
+++ b/pkg/vm_service/test/http_invocations/http_get_isolate_rpc_test.dart
@@ -7,8 +7,7 @@
void main([args = const <String>[]]) => runIsolateTests(
args,
- tests,
+ httpGetIsolateRpcTests,
'http_get_isolate_rpc_test.dart',
- testeeBefore: testeeBefore,
useAuthToken: false,
);