Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
I tried to keep the package updates out of this but two more snuck in. Oh well. |
|
🤷♂️ You could try pinning it in update_packages.dart |
bkonyi
left a comment
There was a problem hiding this comment.
Timeline code and test LGTM
| List<TimelineEvent> events, List<Map<String, dynamic>> expected) { | ||
| for (final TimelineEvent event in events) { | ||
| for (int index = 0; index < expected.length; index += 1) { | ||
| if (expected[index]['name'] == event.json['name']) { |
There was a problem hiding this comment.
This would be cleaner if you did:
for (final e in expected) {
...
if (_mapsEqual(expectedArgs, args)) {
expected.remove(e);
}
}There was a problem hiding this comment.
_mapsEqual assumes it's doing a flat map though, and there are no nested maps. I guess I could update it to check for that...
There was a problem hiding this comment.
I'm trying to short circuit the more expensive recursion this way though by keying on the name. It's faster to check that one property than to recurse the entire structure, which could become large as we add to these tests.
| return; | ||
| TimelineTask timelineTask; | ||
| if (!kReleaseMode) { | ||
| timelineTask = TimelineTask()..start('ImageCache.setMaximumSize', arguments: <String, dynamic>{'value': value}); |
There was a problem hiding this comment.
Nit: You might want to consider breaking this into multiple lines (below as well)
2569ea0 to
6148146
Compare
|
This test either has to be rewritten (the dwds pinned version of vm_service is broken for what the test uses), or we have to get dwds to bump vmservice for this. I'm separately going to open an internal CL to open up visibility for flutter to use this package. |
|
I rewrote the test to not depend on package:vm_service. Filed dart-lang/webdev#899 to track getting that bumped in dwds and added a TODO. |
56766b8 to
c708be9
Compare
| @@ -0,0 +1,7 @@ | |||
| # Tracing tests | |||
|
|
|||
| The tests in this folder must be run with `flutter test --enable-vmservice`, | |||
There was a problem hiding this comment.
Any chance you can check for this condition from within the test and just print this message if the test was run incorrectly?
There was a problem hiding this comment.
(Readmes usually get ignored..)
There was a problem hiding this comment.
Never mind, I see below that you already do this: 🌟
| import 'dart:isolate' as isolate; | ||
|
|
||
| import 'package:flutter/painting.dart'; | ||
|
|
There was a problem hiding this comment.
nit: I believe this blank line shouldn't be here?
| @@ -0,0 +1,7 @@ | |||
| # Tracing tests | |||
There was a problem hiding this comment.
Should this be removed?
There was a problem hiding this comment.
The whole file or this line?
I think most of the folders in dev/ have a README.md - the goal of this one is to make it clear what kind of tests belong in here, and what's special about running them.
There was a problem hiding this comment.
This isn't in dev though, this is in flutter/test
There was a problem hiding this comment.
Ah! Thanks, good catch. Removed.
Description
Add tracing to image cache calls outside of release mode. Looks like this:
And can be easily lined up with engine work to see what's going on. The small line dropping off of
listeneris to a cleanup routine that runs at the end of listening, which is too small to be visible at the zoom level of the screenshot (but is there!) :)./cc @liyuqian @chinmaygarde @alml @ignatz @goderbauer @gaaclarke
Tests
I added the following tests:
I'm trying to figure out the right way to test this. I think we'll need to update a driver test and check that this data is in there to start, but I'm open to suggestions.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.