forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ VM / Service ] Added
getClientName
, setClientName
and `requireR…
…esumeApproval` RPCs Add support for naming VM service clients which allows for resume permissions to be set for all clients of the same name. If a client name requires resume approval, an isolate won't be resumed until all clients which require resume approval have called the `resume` RPC. Resume approvals can be set for the following pause events: - PauseOnStart - PausePostRequest (issued after `reloadSources(pause: true)`) - PauseOnExit Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621 Commit-Queue: Ben Konyi <bkonyi@google.com> Reviewed-by: Siva Annamalai <asiva@google.com> Reviewed-by: Gary Roumanis <grouma@google.com>
- Loading branch information
Showing
25 changed files
with
1,235 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version=3.27 | ||
version=3.29 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
runtime/observatory/tests/service/client_name_rpc_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:observatory/service_io.dart'; | ||
import 'package:unittest/unittest.dart'; | ||
|
||
import 'test_helper.dart'; | ||
|
||
var tests = <VMTest>[ | ||
(VM vm) async { | ||
final defaultClientName = 'client1'; | ||
final clientName = 'agent-007'; | ||
var result = await vm.invokeRpcNoUpgrade('getClientName', {}); | ||
expect(result['type'], 'ClientName'); | ||
expect(result['name'], defaultClientName); | ||
|
||
// Set the name for this client. | ||
result = await vm.invokeRpcNoUpgrade( | ||
'setClientName', | ||
{ | ||
'name': clientName, | ||
}, | ||
); | ||
expect(result['type'], 'Success'); | ||
|
||
// Check it was set properly. | ||
result = await vm.invokeRpcNoUpgrade('getClientName', {}); | ||
expect(result['type'], 'ClientName'); | ||
expect(result['name'], clientName); | ||
|
||
// Check clearing works properly. | ||
result = await vm.invokeRpcNoUpgrade( | ||
'setClientName', | ||
{ | ||
'name': '', | ||
}, | ||
); | ||
expect(result['type'], 'Success'); | ||
|
||
result = await vm.invokeRpcNoUpgrade('getClientName', {}); | ||
expect(result['type'], 'ClientName'); | ||
expect(result['name'], defaultClientName); | ||
}, | ||
// Try to set an invalid agent name for this client. | ||
(VM vm) async { | ||
try { | ||
await vm.invokeRpcNoUpgrade( | ||
'setClientName', | ||
{ | ||
'name': 42, | ||
}, | ||
); | ||
fail('Successfully set invalid client name'); | ||
} on ServerRpcException catch (e) {/* expected */} | ||
}, | ||
// Missing parameters. | ||
(VM vm) async { | ||
try { | ||
await vm.invokeRpcNoUpgrade('setClientName', {}); | ||
fail('Successfully set name with no type'); | ||
} on ServerRpcException catch (e) {/* expected */} | ||
}, | ||
]; | ||
|
||
main(args) async => runVMTests(args, tests); |
Oops, something went wrong.