Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
0c7fe40e
Commit
0c7fe40e
authored
Mar 06, 2019
by
TruongSinh Tran-Nguyen
Committed by
Michael Goderbauer
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #19175 How should addTime be used from a test? (#25202)
parent
ec27e045
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
67 deletions
+53
-67
accessibility_test.dart
examples/flutter_gallery/test/accessibility_test.dart
+33
-66
binding.dart
packages/flutter_test/lib/src/binding.dart
+7
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+13
-0
No files found.
examples/flutter_gallery/test/accessibility_test.dart
View file @
0c7fe40e
This diff is collapsed.
Click to expand it.
packages/flutter_test/lib/src/binding.dart
View file @
0c7fe40e
...
...
@@ -125,6 +125,11 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
@protected
bool
get
disableShadows
=>
false
;
/// Increase the timeout for the current test by the given duration.
void
addTime
(
Duration
duration
)
{
// Noop, see [AutomatedTestWidgetsFlutterBinding. addTime] for an actual implementation.
}
/// The value to set [debugCheckIntrinsicSizes] to while tests are running.
///
/// This can be used to enable additional checks. For example,
...
...
@@ -843,7 +848,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
_timeoutCompleter
.
completeError
(
TimeoutException
(
'The test exceeded the timeout. It may have hung.
\n
'
'Consider using "addTime" to increase the timeout before expensive operations.'
,
'Consider using "
tester.binding.
addTime" to increase the timeout before expensive operations.'
,
_timeout
,
),
);
...
...
@@ -873,6 +878,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
///
/// * [defaultTestTimeout], the maximum that the timeout can reach.
/// (That timeout is implemented by the test package.)
@override
void
addTime
(
Duration
duration
)
{
assert
(
_timeout
!=
null
,
'addTime can only be called during a test.'
);
_timeout
+=
duration
;
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
0c7fe40e
...
...
@@ -49,6 +49,14 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
///
/// The callback can be asynchronous (using `async`/`await` or
/// using explicit [Future]s).
/// Tests using the [AutomatedTestWidgetsFlutterBinding]
/// have a default time out of two seconds,
/// which is automatically increased for some expensive operations,
/// and can also be manually increased by calling
/// [AutomatedTestWidgetsFlutterBinding.addTime].
/// The maximum that this timeout can reach (automatically or manually increased)
/// is defined by the timeout property,
/// which defaults to [TestWidgetsFlutterBinding.defaultTestTimeout].
///
/// This function uses the [test] function in the test package to
/// register the given callback as a test. The callback, when run,
...
...
@@ -56,6 +64,11 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
/// provides convenient widget [Finder]s for use with the
/// [WidgetTester].
///
/// See also:
///
/// * [AutomatedTestWidgetsFlutterBinding.addTime] to learn more about
/// timeout and how to manually increase timeouts.
///
/// ## Sample code
///
/// ```dart
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment