-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
pkgs/leak_tracker_flutter_test/test/end_to_end/no_config_test.dart
This file contains 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,46 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:leak_tracker/leak_tracker.dart'; | ||
|
||
import '../test_infra/flutter_classes.dart'; | ||
import '../test_infra/leak_tracking_in_flutter.dart'; | ||
|
||
const test0TrackingOff = 'test0, tracking-off'; | ||
const test1TrackingOn = 'test1, tracking-on'; | ||
const test2TrackingOff = 'test2, tracking-off'; | ||
const test3TrackingOn = 'test3, tracking-on'; | ||
|
||
/// Tests with default leak tracking configuration. | ||
/// | ||
/// This set of tests verifies that if `testWidgetsWithLeakTracking` is used at least once, | ||
/// leak tracking is configured as expected, and is noop for `testWidgets`. | ||
void main() { | ||
testWidgets(test0TrackingOff, (widgetTester) async { | ||
expect(LeakTracking.isStarted, true); | ||
expect(LeakTracking.phase.name, null); | ||
expect(LeakTracking.phase.isPaused, true); | ||
await widgetTester.pumpWidget(StatelessLeakingWidget()); | ||
}); | ||
|
||
testWidgetsWithLeakTracking(test1TrackingOn, (widgetTester) async { | ||
expect(LeakTracking.isStarted, true); | ||
expect(LeakTracking.phase.name, test1TrackingOn); | ||
expect(LeakTracking.phase.isPaused, false); | ||
}); | ||
|
||
testWidgets(test2TrackingOff, (widgetTester) async { | ||
expect(LeakTracking.isStarted, true); | ||
expect(LeakTracking.phase.name, null); | ||
expect(LeakTracking.phase.isPaused, true); | ||
await widgetTester.pumpWidget(StatelessLeakingWidget()); | ||
}); | ||
|
||
testWidgetsWithLeakTracking(test3TrackingOn, (widgetTester) async { | ||
expect(LeakTracking.isStarted, true); | ||
expect(LeakTracking.phase.name, test3TrackingOn); | ||
expect(LeakTracking.phase.isPaused, false); | ||
}); | ||
} |
This file contains 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
This file contains 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
This file contains 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