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
622e4396
Commit
622e4396
authored
Dec 08, 2016
by
Todd Volkert
Committed by
GitHub
Dec 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for nested contexts (#7197)
This tests against the failure that was fixed in #7189
parent
1155f966
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
context.dart
packages/flutter_tools/lib/src/base/context.dart
+2
-2
context_test.dart
packages/flutter_tools/test/context_test.dart
+27
-1
No files found.
packages/flutter_tools/lib/executable.dart
View file @
622e4396
...
...
@@ -94,7 +94,7 @@ Future<Null> main(List<String> args) async {
AppContext
_executableContext
=
new
AppContext
();
// Make the context current.
_executableContext
.
runInZone
(()
{
await
_executableContext
.
runInZone
(()
{
// Initialize the context with some defaults.
// NOTE: Similar lists also exist in `bin/fuchsia_builder.dart` and
// `test/src/context.dart`. If you update this list of defaults, look
...
...
packages/flutter_tools/lib/src/base/context.dart
View file @
622e4396
...
...
@@ -59,7 +59,7 @@ class AppContext {
:
parentContext
;
}
dynamic
runInZone
(
dynamic
method
(),
{
Future
<
dynamic
>
runInZone
(
dynamic
method
(),
{
ZoneBinaryCallback
<
dynamic
,
dynamic
,
StackTrace
>
onError
})
{
return
runZoned
(
...
...
@@ -69,7 +69,7 @@ class AppContext {
);
}
dynamic
_run
(
dynamic
method
())
async
{
Future
<
dynamic
>
_run
(
dynamic
method
())
async
{
Zone
previousZone
=
_zone
;
try
{
_zone
=
Zone
.
current
;
...
...
packages/flutter_tools/test/context_test.dart
View file @
622e4396
...
...
@@ -8,7 +8,7 @@ import 'package:flutter_tools/src/globals.dart';
import
'package:test/test.dart'
;
void
main
(
)
{
group
(
'
DeviceManager
'
,
()
{
group
(
'
AppContext
'
,
()
{
test
(
'error'
,
()
async
{
AppContext
context
=
new
AppContext
();
BufferLogger
mockLogger
=
new
BufferLogger
();
...
...
@@ -50,5 +50,31 @@ void main() {
expect
(
mockLogger
.
statusText
,
''
);
expect
(
mockLogger
.
traceText
,
'foo bar
\n
'
);
});
test
(
'awaitNestedZones'
,
()
async
{
AppContext
outerContext
=
new
AppContext
();
await
outerContext
.
runInZone
(()
async
{
AppContext
middleContext
=
new
AppContext
();
await
middleContext
.
runInZone
(()
async
{
AppContext
innerContext
=
new
AppContext
();
await
innerContext
.
runInZone
(()
async
{
expect
(
innerContext
.
getVariable
(
String
),
isNull
);
});
});
});
});
test
(
'fireAndForgetNestedZones'
,
()
async
{
AppContext
outerContext
=
new
AppContext
();
outerContext
.
runInZone
(()
async
{
AppContext
middleContext
=
new
AppContext
();
middleContext
.
runInZone
(()
async
{
AppContext
innerContext
=
new
AppContext
();
innerContext
.
runInZone
(()
async
{
expect
(
innerContext
.
getVariable
(
String
),
isNull
);
});
});
});
});
});
}
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