Gallery demo start-time performance test (#3655)

*  Gallery demo start-time performance test
This commit is contained in:
Hans Muller
2016-05-03 17:37:10 -07:00
parent 76b04cddde
commit a9b965cb9b
10 changed files with 231 additions and 20 deletions

View File

@@ -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');
});
});
});
}