Gallery demo start-time performance test (#3655)
* Gallery demo start-time performance test
This commit is contained in:
@@ -235,6 +235,50 @@ void main() {
|
||||
expect(timeline.events.single.name, 'test event');
|
||||
});
|
||||
});
|
||||
|
||||
group('traceAction categories', () {
|
||||
test('specify non-default categories', () async {
|
||||
bool actionCalled = false;
|
||||
bool startTracingCalled = false;
|
||||
bool stopTracingCalled = false;
|
||||
|
||||
when(mockPeer.sendRequest('_setVMTimelineFlags', argThat(equals({'recordedStreams': '[Dart, GC, Compiler]'}))))
|
||||
.thenAnswer((_) async {
|
||||
startTracingCalled = true;
|
||||
return null;
|
||||
});
|
||||
|
||||
when(mockPeer.sendRequest('_setVMTimelineFlags', argThat(equals({'recordedStreams': '[]'}))))
|
||||
.thenAnswer((_) async {
|
||||
stopTracingCalled = true;
|
||||
return null;
|
||||
});
|
||||
|
||||
when(mockPeer.sendRequest('_getVMTimeline')).thenAnswer((_) async {
|
||||
return <String, dynamic> {
|
||||
'traceEvents': [
|
||||
{
|
||||
'name': 'test event'
|
||||
}
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
Timeline timeline = await driver.traceAction(() {
|
||||
actionCalled = true;
|
||||
},
|
||||
categories: const <TracingCategory>[
|
||||
TracingCategory.dart,
|
||||
TracingCategory.gc,
|
||||
TracingCategory.compiler
|
||||
]);
|
||||
|
||||
expect(actionCalled, isTrue);
|
||||
expect(startTracingCalled, isTrue);
|
||||
expect(stopTracingCalled, isTrue);
|
||||
expect(timeline.events.single.name, 'test event');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user