Made flag for debugging build time of user created widgets (#100926)

* Added a bool that allows us to limit debugProfileBuildsEnabled to user
created widgets.

* made it turned on by default

* switched to hashmap

* Cleaned everything up and added tests

* fixed an odd test where it wants to be able to add asserts and run in profile mode

* hixie feedback

* hixie2

* made it default to false

* updated docstring as per dans request
This commit is contained in:
gaaclarke
2022-04-05 10:54:21 -07:00
committed by GitHub
parent 839a183ea6
commit 35b18ba2e9
7 changed files with 139 additions and 25 deletions

View File

@@ -110,6 +110,17 @@ void main() {
expect(args['color'], 'Color(0xffffffff)');
debugProfileBuildsEnabled = false;
debugProfileBuildsEnabledUserWidgets = true;
await runFrame(() { TestRoot.state.updateWidget(Placeholder(key: UniqueKey(), color: const Color(0xFFFFFFFF))); });
events = await fetchInterestingEvents(interestingLabels);
expect(
events.map<String>(eventToName),
<String>['BUILD', 'Placeholder', 'LAYOUT', 'UPDATING COMPOSITING BITS', 'PAINT', 'COMPOSITING', 'FINALIZE TREE'],
);
args = (events.where((TimelineEvent event) => event.json!['name'] == '$Placeholder').single.json!['args'] as Map<String, Object?>).cast<String, String>();
expect(args['color'], 'Color(0xffffffff)');
debugProfileBuildsEnabledUserWidgets = false;
debugProfileLayoutsEnabled = true;
await runFrame(() { TestRoot.state.updateWidget(Placeholder(key: UniqueKey())); });
events = await fetchInterestingEvents(interestingLabels);