-
Notifications
You must be signed in to change notification settings - Fork 390
Show debug-mode message for widget rebuilds in profile mode #9755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
crackedhandle
wants to merge
14
commits into
flutter:master
Choose a base branch
from
crackedhandle:fix-widget-rebuilds-profile-mode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+79
−43
Open
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1a35297
Show debug-mode message for widget rebuilds in profile mode
crackedhandle 44942d2
Move RebuildStatsView tests to performance_screen_test
crackedhandle c211407
Fix formatting and add release note
crackedhandle 6d34fe4
Resolve merge conflict in release notes
crackedhandle 3d6432d
Merge branch 'master' into fix-widget-rebuilds-profile-mode
crackedhandle 94bb82e
Resolve merge conflict in release notes
crackedhandle a396051
fix: align release notes with 2.58.0 and reviewer feedback
crackedhandle 58ea256
style: format performance_screen_test
crackedhandle 2632c20
fix: restore removed tests and apply only required changes
crackedhandle 2070fc9
style: format file and add required comments
crackedhandle 1f4104c
fix: properly remove build artifacts
crackedhandle 788a58e
Remove unnecessary imports
crackedhandle 81de5c8
Revise release notes for DevTools 2.58.0
crackedhandle 96a4f70
Revise NEXT_RELEASE_NOTES.md for 2.58.0 release
crackedhandle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
packages/devtools_app/test/screens/performance/rebuild_stats/rebuild_stats_view_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // Copyright 2026 The Flutter Authors | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
|
|
||
| import 'dart:async'; | ||
|
|
||
| import 'package:devtools_app/devtools_app.dart'; | ||
| import 'package:devtools_app/src/screens/performance/panes/rebuild_stats/rebuild_stats.dart'; | ||
| import 'package:devtools_app/src/screens/performance/panes/rebuild_stats/rebuild_stats_model.dart'; | ||
| import 'package:devtools_app/src/screens/performance/panes/flutter_frames/flutter_frame_model.dart'; | ||
| import 'package:devtools_app_shared/service.dart'; | ||
| import 'package:devtools_app/devtools_app.dart'; | ||
| import 'package:devtools_app_shared/ui.dart'; | ||
| import 'package:devtools_app_shared/utils.dart'; | ||
| import 'package:devtools_test/devtools_test.dart'; | ||
| import 'package:devtools_test/helpers.dart'; | ||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:mockito/mockito.dart'; | ||
|
|
||
| void main() { | ||
| group('RebuildStatsView', () { | ||
| late FakeServiceConnectionManager fakeServiceConnection; | ||
| late RebuildCountModel model; | ||
| late ValueNotifier<FlutterFrame?> selectedFrame; | ||
|
|
||
| setUp(() { | ||
| fakeServiceConnection = FakeServiceConnectionManager(); | ||
| final app = fakeServiceConnection.serviceManager.connectedApp!; | ||
| when(app.initialized).thenReturn(Completer()..complete(true)); | ||
| when(app.isDartWebAppNow).thenReturn(false); | ||
| when(app.isFlutterAppNow).thenReturn(true); | ||
| when(app.isDartCliAppNow).thenReturn(false); | ||
| when(app.isDartWebApp).thenAnswer((_) async => false); | ||
| when(app.isProfileBuild).thenAnswer((_) async => false); | ||
| setGlobal(ServiceConnectionManager, fakeServiceConnection); | ||
| setGlobal(IdeTheme, IdeTheme()); | ||
| setGlobal(NotificationService, NotificationService()); | ||
| setGlobal(BannerMessagesController, BannerMessagesController()); | ||
| setGlobal(PreferencesController, PreferencesController()); | ||
| setGlobal(OfflineDataController, OfflineDataController()); | ||
| model = RebuildCountModel(); | ||
| selectedFrame = ValueNotifier<FlutterFrame?>(null); | ||
| }); | ||
|
|
||
| testWidgets( | ||
| 'shows message when running in profile mode', | ||
| (WidgetTester tester) async { | ||
| final app = fakeServiceConnection.serviceManager.connectedApp!; | ||
| when(app.isProfileBuildNow).thenReturn(true); | ||
|
|
||
| await tester.pumpWidget( | ||
| wrapWithControllers( | ||
| RebuildStatsView( | ||
| model: model, | ||
| selectedFrame: selectedFrame, | ||
| ), | ||
| ), | ||
| ); | ||
| await tester.pump(); | ||
|
|
||
| expect( | ||
| find.textContaining('Widget rebuild counts are only available'), | ||
| findsOneWidget, | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| testWidgets( | ||
| 'shows normal UI when running in debug mode', | ||
| (WidgetTester tester) async { | ||
| final app = fakeServiceConnection.serviceManager.connectedApp!; | ||
| when(app.isProfileBuildNow).thenReturn(false); | ||
|
|
||
| await tester.pumpWidget( | ||
| wrapWithControllers( | ||
| RebuildStatsView( | ||
| model: model, | ||
| selectedFrame: selectedFrame, | ||
| ), | ||
| ), | ||
| ); | ||
| await tester.pump(); | ||
|
|
||
| expect( | ||
| find.textContaining('Widget rebuild counts are only available'), | ||
| findsNothing, | ||
| ); | ||
| }, | ||
| ); | ||
| }); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add these tests cases to the
performance_screen_testinstead of creating a new test suite? Thanks!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review the required changes @elliette ! thanks