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
ae143ad8
Unverified
Commit
ae143ad8
authored
Oct 25, 2022
by
Jason Simmons
Committed by
GitHub
Oct 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide debug logs from a MemoryAllocations test that intentionally throws an exception (#113786)
parent
92d8b04b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
memory_allocations_test.dart
...ages/flutter/test/foundation/memory_allocations_test.dart
+23
-1
No files found.
packages/flutter/test/foundation/memory_allocations_test.dart
View file @
ae143ad8
...
@@ -7,9 +7,29 @@ import 'dart:ui';
...
@@ -7,9 +7,29 @@ import 'dart:ui';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
class
PrintOverrideTestBinding
extends
AutomatedTestWidgetsFlutterBinding
{
@override
DebugPrintCallback
get
debugPrintOverride
=>
_enablePrint
?
debugPrint
:
_emptyPrint
;
static
void
_emptyPrint
(
String
?
message
,
{
int
?
wrapWidth
})
{}
static
bool
_enablePrint
=
true
;
static
void
runWithDebugPrintDisabled
(
void
Function
()
f
)
{
try
{
_enablePrint
=
false
;
f
();
}
finally
{
_enablePrint
=
true
;
}
}
}
void
main
(
)
{
void
main
(
)
{
final
MemoryAllocations
ma
=
MemoryAllocations
.
instance
;
final
MemoryAllocations
ma
=
MemoryAllocations
.
instance
;
PrintOverrideTestBinding
();
setUp
(()
{
setUp
(()
{
assert
(!
ma
.
hasListeners
);
assert
(!
ma
.
hasListeners
);
_checkSdkHandlersNotSet
();
_checkSdkHandlersNotSet
();
...
@@ -56,7 +76,9 @@ void main() {
...
@@ -56,7 +76,9 @@ void main() {
ma
.
addListener
(
badListener2
);
ma
.
addListener
(
badListener2
);
ma
.
addListener
(
listener2
);
ma
.
addListener
(
listener2
);
ma
.
dispatchObjectEvent
(
event
);
PrintOverrideTestBinding
.
runWithDebugPrintDisabled
(
()
=>
ma
.
dispatchObjectEvent
(
event
)
);
expect
(
log
,
<
String
>[
'badListener1'
,
'listener1'
,
'badListener2'
,
'listener2'
]);
expect
(
log
,
<
String
>[
'badListener1'
,
'listener1'
,
'badListener2'
,
'listener2'
]);
expect
(
tester
.
takeException
(),
contains
(
'Multiple exceptions (2)'
));
expect
(
tester
.
takeException
(),
contains
(
'Multiple exceptions (2)'
));
...
...
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