[flutter_driver] make empty duration messages more helpful (#110441)

This commit is contained in:
Jonah Williams
2022-08-28 12:54:08 -07:00
committed by GitHub
parent 0c6d786e3a
commit 0053b089a6
2 changed files with 52 additions and 17 deletions

View File

@@ -159,7 +159,12 @@ void main() {
test('throws when there is no data', () {
expect(
() => summarize(<Map<String, dynamic>>[]).computeAverageFrameBuildTimeMillis(),
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
throwsA(
isA<StateError>()
.having((StateError e) => e.message,
'message',
contains('The TimelineSummary had no events to summarize.'),
)),
);
});
@@ -223,7 +228,12 @@ void main() {
test('throws when there is no data', () {
expect(
() => summarize(<Map<String, dynamic>>[]).computeWorstFrameBuildTimeMillis(),
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
throwsA(
isA<StateError>()
.having((StateError e) => e.message,
'message',
contains('The TimelineSummary had no events to summarize.'),
)),
);
});
@@ -282,7 +292,12 @@ void main() {
test('throws when there is no data', () {
expect(
() => summarize(<Map<String, dynamic>>[]).computeAverageFrameRasterizerTimeMillis(),
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
throwsA(
isA<StateError>()
.having((StateError e) => e.message,
'message',
contains('The TimelineSummary had no events to summarize.'),
)),
);
});
@@ -321,7 +336,12 @@ void main() {
test('throws when there is no data', () {
expect(
() => summarize(<Map<String, dynamic>>[]).computeWorstFrameRasterizerTimeMillis(),
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
throwsA(
isA<StateError>()
.having((StateError e) => e.message,
'message',
contains('The TimelineSummary had no events to summarize.'),
)),
);
});
@@ -368,7 +388,12 @@ void main() {
test('throws when there is no data', () {
expect(
() => summarize(<Map<String, dynamic>>[]).computePercentileFrameRasterizerTimeMillis(90.0),
throwsA(predicate<ArgumentError>((ArgumentError e) => e.message == 'durations is empty!')),
throwsA(
isA<StateError>()
.having((StateError e) => e.message,
'message',
contains('The TimelineSummary had no events to summarize.'),
)),
);
});