@@ -90,8 +90,6 @@ void main() {
9090 await tester.pump ();
9191
9292 if (runAsync) {
93- // Await a small delay to allow the PerformanceController to complete
94- // initialization.
9593 await Future .delayed (const Duration (seconds: 1 ));
9694 }
9795
@@ -116,24 +114,6 @@ void main() {
116114 expect (find.text ('Performance' ), findsOneWidget);
117115 });
118116
119- testWidgetsWithWindowSize ('builds initial content' , windowSize, (
120- WidgetTester tester,
121- ) async {
122- await tester.runAsync (() async {
123- await pumpPerformanceScreen (tester, runAsync: true );
124- await tester.pumpAndSettle ();
125- expect (find.byType (PerformanceScreenBody ), findsOneWidget);
126- expect (find.byType (WebPerformanceScreenBody ), findsNothing);
127- expect (find.byType (PerformanceControls ), findsOneWidget);
128- expect (find.byType (FlutterFramesChart ), findsOneWidget);
129- expect (find.byType (TabbedPerformanceView ), findsOneWidget);
130- expect (
131- find.text ('Select a frame above to view analysis data.' ),
132- findsOneWidget,
133- );
134- });
135- });
136-
137117 testWidgetsWithWindowSize (
138118 'builds initial content for Dart web app' ,
139119 windowSize,
@@ -148,15 +128,10 @@ void main() {
148128 wrap (Builder (builder: PerformanceScreen ().build)),
149129 );
150130 await tester.pumpAndSettle ();
151- expect (find. byType ( PerformanceScreenBody ), findsNothing);
131+
152132 expect (find.byType (WebPerformanceScreenBody ), findsOneWidget);
153- expect (
154- markdownFinder (
155- 'How to use Chrome DevTools for performance profiling' ,
156- ),
157- findsOneWidget,
158- );
159133
134+ // Make sure NO Flutter-specific information is included:
160135 expect (
161136 markdownFinder ('The Flutter framework emits timeline events' ),
162137 findsNothing,
@@ -177,41 +152,17 @@ void main() {
177152 wrap (Builder (builder: PerformanceScreen ().build)),
178153 );
179154 await tester.pumpAndSettle ();
180- expect (find. byType ( PerformanceScreenBody ), findsNothing);
155+
181156 expect (find.byType (WebPerformanceScreenBody ), findsOneWidget);
182- expect (
183- markdownFinder (
184- 'How to use Chrome DevTools for performance profiling' ,
185- ),
186- findsOneWidget,
187- );
188157
158+ // Make sure Flutter-specific information IS included:
189159 expect (
190160 markdownFinder ('The Flutter framework emits timeline events' ),
191161 findsOneWidget,
192162 );
193163 },
194164 );
195165
196- testWidgetsWithWindowSize (
197- 'builds initial content for non-flutter app' ,
198- windowSize,
199- (WidgetTester tester) async {
200- await tester.runAsync (() async {
201- mockConnectedApp (
202- fakeServiceConnection.serviceManager.connectedApp! ,
203- isFlutterApp: false ,
204- );
205- await pumpPerformanceScreen (tester, runAsync: true );
206- await tester.pumpAndSettle ();
207- expect (find.byType (PerformanceControls ), findsOneWidget);
208- expect (find.byType (FlutterFramesChart ), findsNothing);
209- expect (find.byType (TabbedPerformanceView ), findsOneWidget);
210- expect (find.byType (TimelineEventsTabView ), findsOneWidget);
211- });
212- },
213- );
214-
215166 group ('controls' , () {
216167 testWidgetsWithWindowSize (
217168 'can expand and collapse flutter frames chart' ,
@@ -222,169 +173,38 @@ void main() {
222173 await tester.pumpAndSettle ();
223174
224175 final chartButtonFinder = find.byType (VisibilityButton );
225- expect (chartButtonFinder, findsOneWidget);
226176
177+ // The flutter frames chart is visible.
227178 expect (find.byType (FramesChartControls ), findsOneWidget);
228- expect (
229- preferences.performance.showFlutterFramesChart.value,
230- isTrue,
231- );
232179
233180 await tester.tap (chartButtonFinder);
234181 await tester.pumpAndSettle ();
235182
183+ // The flutter frames chart should no longer be visible.
236184 expect (find.byType (FramesChartControls ), findsNothing);
237- expect (
238- preferences.performance.showFlutterFramesChart.value,
239- isFalse,
240- );
241185
242186 await tester.tap (chartButtonFinder);
243187 await tester.pumpAndSettle ();
244188
189+ // The flutter frames chart should be visible again.
245190 expect (find.byType (FramesChartControls ), findsOneWidget);
246- expect (
247- preferences.performance.showFlutterFramesChart.value,
248- isTrue,
249- );
250- });
251- },
252- );
253-
254- testWidgetsWithWindowSize ('opens enhance tracing overlay' , windowSize, (
255- WidgetTester tester,
256- ) async {
257- await tester.runAsync (() async {
258- await pumpPerformanceScreen (tester, runAsync: true );
259- await tester.pumpAndSettle ();
260- expect (find.text ('Enhance Tracing' ), findsOneWidget);
261- await tester.tap (find.text ('Enhance Tracing' ));
262- await tester.pumpAndSettle ();
263- expect (
264- find.richTextContaining ('frame times may be negatively affected' ),
265- findsOneWidget,
266- );
267- expect (
268- find.richTextContaining (
269- 'you will need to reproduce activity in your app' ,
270- ),
271- findsOneWidget,
272- );
273- expect (
274- find.richTextContaining ('Trace widget builds' ),
275- findsOneWidget,
276- );
277- expect (find.richTextContaining ('Trace layouts' ), findsOneWidget);
278- expect (find.richTextContaining ('Trace paints' ), findsOneWidget);
279- expect (
280- find.richTextContaining ('Trace platform channels' ),
281- findsOneWidget,
282- );
283- expect (find.byType (MoreInfoLink ), findsNWidgets (4 ));
284- });
285- });
286-
287- testWidgetsWithWindowSize (
288- 'opens more debugging options overlay' ,
289- windowSize,
290- (WidgetTester tester) async {
291- await tester.runAsync (() async {
292- await pumpPerformanceScreen (tester, runAsync: true );
293- await tester.pumpAndSettle ();
294- expect (find.text ('More debugging options' ), findsOneWidget);
295- await tester.tap (find.text ('More debugging options' ));
296- await tester.pumpAndSettle ();
297- expect (
298- find.richTextContaining (
299- 'After toggling a rendering layer on/off, '
300- 'reproduce the activity in your app to see the effects' ,
301- ),
302- findsOneWidget,
303- );
304- expect (
305- find.richTextContaining ('Render Clip layers' ),
306- findsOneWidget,
307- );
308- expect (
309- find.richTextContaining ('Render Opacity layers' ),
310- findsOneWidget,
311- );
312- expect (
313- find.richTextContaining ('Render Physical Shape layers' ),
314- findsOneWidget,
315- );
316- expect (
317- find.richTextContaining (
318- "These debugging options aren't available in profile mode. "
319- 'To use them, run your app in debug mode.' ,
320- ),
321- findsOneWidget,
322- );
323- expect (find.byType (MoreInfoLink ), findsNWidgets (3 ));
324- });
325- },
326- );
327-
328- testWidgetsWithWindowSize (
329- 'hides warning in debugging options overlay when in debug mode' ,
330- windowSize,
331- (WidgetTester tester) async {
332- when (
333- fakeServiceConnection
334- .serviceManager
335- .connectedApp!
336- .isProfileBuildNow,
337- ).thenReturn (false );
338-
339- await tester.runAsync (() async {
340- await pumpPerformanceScreen (tester, runAsync: true );
341- await tester.pumpAndSettle ();
342- expect (find.text ('More debugging options' ), findsOneWidget);
343- await tester.tap (find.text ('More debugging options' ));
344- await tester.pumpAndSettle ();
345-
346- expect (
347- find.richTextContaining (
348- "These debugging options aren't available in profile mode. "
349- 'To use them, run your app in debug mode.' ,
350- ),
351- findsNothing,
352- );
353191 });
354192 },
355193 );
356194 });
357195
358196 group ('RebuildStatsView' , () {
359- late FakeServiceConnectionManager fakeServiceConnection;
360197 late RebuildCountModel model;
361198 late ValueNotifier <FlutterFrame ?> selectedFrame;
362199
363200 setUp (() {
364- fakeServiceConnection = FakeServiceConnectionManager ();
365- final app = fakeServiceConnection.serviceManager.connectedApp! ;
366- when (app.initialized).thenReturn (Completer ()..complete (true ));
367- when (app.isDartWebAppNow).thenReturn (false );
368- when (app.isFlutterAppNow).thenReturn (true );
369- when (app.isDartCliAppNow).thenReturn (false );
370- when (app.isDartWebApp).thenAnswer ((_) async => false );
371- when (app.isProfileBuild).thenAnswer ((_) async => false );
372- setGlobal (ServiceConnectionManager , fakeServiceConnection);
373- setGlobal (IdeTheme , IdeTheme ());
374- setGlobal (NotificationService , NotificationService ());
375- setGlobal (BannerMessagesController , BannerMessagesController ());
376- setGlobal (PreferencesController , PreferencesController ());
377- setGlobal (OfflineDataController , OfflineDataController ());
378201 model = RebuildCountModel ();
379202 selectedFrame = ValueNotifier <FlutterFrame ?>(null );
380203 });
381204
382205 testWidgets ('shows message when running in profile mode' , (
383206 WidgetTester tester,
384207 ) async {
385- final app = fakeServiceConnection.serviceManager.connectedApp! ;
386- when (app.isProfileBuildNow).thenReturn (true );
387-
388208 await tester.pumpWidget (
389209 wrapWithControllers (
390210 RebuildStatsView (model: model, selectedFrame: selectedFrame),
@@ -401,9 +221,6 @@ void main() {
401221 testWidgets ('shows normal UI when running in debug mode' , (
402222 WidgetTester tester,
403223 ) async {
404- final app = fakeServiceConnection.serviceManager.connectedApp! ;
405- when (app.isProfileBuildNow).thenReturn (false );
406-
407224 await tester.pumpWidget (
408225 wrapWithControllers (
409226 RebuildStatsView (model: model, selectedFrame: selectedFrame),
0 commit comments