Skip to content

Commit

Permalink
Use the new service protocol message names (flutter#35482)
Browse files Browse the repository at this point in the history
* Use the new service protocol message names
  clearVMTimeline
  setVMTimelineFlags
  getVMTimeline
  getVMTimelineFlags

* Fix clearTimeline at another spot.
  • Loading branch information
a-siva authored and johnsonmh committed Jul 30, 2019
1 parent 52abda9 commit 7dfb3a6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/flutter_driver/lib/src/driver/driver.dart
Expand Up @@ -136,9 +136,9 @@ class FlutterDriver {
_driverId = _nextDriverId++;

static const String _flutterExtensionMethodName = 'ext.flutter.driver';
static const String _setVMTimelineFlagsMethodName = '_setVMTimelineFlags';
static const String _getVMTimelineMethodName = '_getVMTimeline';
static const String _clearVMTimelineMethodName = '_clearVMTimeline';
static const String _setVMTimelineFlagsMethodName = 'setVMTimelineFlags';
static const String _getVMTimelineMethodName = 'getVMTimeline';
static const String _clearVMTimelineMethodName = 'clearVMTimeline';
static const String _collectAllGarbageMethodName = '_collectAllGarbage';

static int _nextDriverId = 0;
Expand Down
16 changes: 8 additions & 8 deletions packages/flutter_driver/test/flutter_driver_test.dart
Expand Up @@ -369,7 +369,7 @@ void main() {
group('clearTimeline', () {
test('clears timeline', () async {
bool clearWasCalled = false;
when(mockPeer.sendRequest('_clearVMTimeline', argThat(equals(<String, dynamic>{}))))
when(mockPeer.sendRequest('clearVMTimeline', argThat(equals(<String, dynamic>{}))))
.thenAnswer((Invocation invocation) async {
clearWasCalled = true;
return null;
Expand All @@ -385,25 +385,25 @@ void main() {
setUp(() async {
log = <String>[];

when(mockPeer.sendRequest('_clearVMTimeline', argThat(equals(<String, dynamic>{}))))
when(mockPeer.sendRequest('clearVMTimeline', argThat(equals(<String, dynamic>{}))))
.thenAnswer((Invocation invocation) async {
log.add('clear');
return null;
});

when(mockPeer.sendRequest('_setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[all]'}))))
when(mockPeer.sendRequest('setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[all]'}))))
.thenAnswer((Invocation invocation) async {
log.add('startTracing');
return null;
});

when(mockPeer.sendRequest('_setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[]'}))))
when(mockPeer.sendRequest('setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[]'}))))
.thenAnswer((Invocation invocation) async {
log.add('stopTracing');
return null;
});

when(mockPeer.sendRequest('_getVMTimeline')).thenAnswer((Invocation invocation) async {
when(mockPeer.sendRequest('getVMTimeline')).thenAnswer((Invocation invocation) async {
log.add('download');
return <String, dynamic>{
'traceEvents': <dynamic>[
Expand Down Expand Up @@ -451,19 +451,19 @@ void main() {
bool startTracingCalled = false;
bool stopTracingCalled = false;

when(mockPeer.sendRequest('_setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[Dart, GC, Compiler]'}))))
when(mockPeer.sendRequest('setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[Dart, GC, Compiler]'}))))
.thenAnswer((Invocation invocation) async {
startTracingCalled = true;
return null;
});

when(mockPeer.sendRequest('_setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[]'}))))
when(mockPeer.sendRequest('setVMTimelineFlags', argThat(equals(<String, dynamic>{'recordedStreams': '[]'}))))
.thenAnswer((Invocation invocation) async {
stopTracingCalled = true;
return null;
});

when(mockPeer.sendRequest('_getVMTimeline')).thenAnswer((Invocation invocation) async {
when(mockPeer.sendRequest('getVMTimeline')).thenAnswer((Invocation invocation) async {
return <String, dynamic>{
'traceEvents': <dynamic>[
<String, String>{
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_tools/lib/src/vmservice.dart
Expand Up @@ -948,21 +948,21 @@ class VM extends ServiceObjectOwner {
}

Future<Map<String, dynamic>> clearVMTimeline() {
return invokeRpcRaw('_clearVMTimeline');
return invokeRpcRaw('clearVMTimeline');
}

Future<Map<String, dynamic>> setVMTimelineFlags(List<String> recordedStreams) {
assert(recordedStreams != null);
return invokeRpcRaw(
'_setVMTimelineFlags',
'setVMTimelineFlags',
params: <String, dynamic>{
'recordedStreams': recordedStreams,
},
);
}

Future<Map<String, dynamic>> getVMTimeline() {
return invokeRpcRaw('_getVMTimeline');
return invokeRpcRaw('getVMTimeline');
}

Future<void> refreshViews({ bool waitForViews = false }) async {
Expand Down

0 comments on commit 7dfb3a6

Please sign in to comment.