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
d2947571
Unverified
Commit
d2947571
authored
Feb 18, 2020
by
Martin Kustermann
Committed by
GitHub
Feb 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure to close connection to VM after collecting coverage (#50943)
parent
11589ca2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+4
-1
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+2
-0
vmservice_test.dart
...ages/flutter_tools/test/general.shard/vmservice_test.dart
+11
-4
No files found.
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
d2947571
...
...
@@ -181,7 +181,10 @@ Future<Map<String, dynamic>> collect(Uri serviceUri, bool Function(String) libra
})
async
{
final
VMService
vmService
=
await
connector
(
serviceUri
);
await
vmService
.
getVM
();
return
_getAllCoverage
(
vmService
,
libraryPredicate
);
final
Map
<
String
,
dynamic
>
result
=
await
_getAllCoverage
(
vmService
,
libraryPredicate
);
await
vmService
.
close
();
return
result
;
}
Future
<
Map
<
String
,
dynamic
>>
_getAllCoverage
(
VMService
service
,
bool
Function
(
String
)
libraryPredicate
)
async
{
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
d2947571
...
...
@@ -452,6 +452,8 @@ class VMService {
Future
<
void
>
getVM
()
async
=>
await
vm
.
reload
();
Future
<
void
>
refreshViews
({
bool
waitForViews
=
false
})
=>
vm
.
refreshViews
(
waitForViews:
waitForViews
);
Future
<
void
>
close
()
async
=>
await
_peer
.
close
();
}
/// An error that is thrown when constructing/updating a service object.
...
...
packages/flutter_tools/test/general.shard/vmservice_test.dart
View file @
d2947571
...
...
@@ -33,13 +33,11 @@ class MockPeer implements rpc.Peer {
}
@override
bool
get
isClosed
{
throw
'unexpected call to isClosed'
;
}
bool
get
isClosed
=>
_isClosed
;
@override
Future
<
dynamic
>
close
()
async
{
throw
'unexpected call to close()'
;
_isClosed
=
true
;
}
@override
...
...
@@ -70,6 +68,7 @@ class MockPeer implements rpc.Peer {
List
<
String
>
registeredMethods
=
<
String
>[];
bool
isolatesEnabled
=
false
;
bool
_isClosed
=
false
;
Future
<
void
>
_getVMLatch
;
Completer
<
void
>
_currentGetVMLatchCompleter
;
...
...
@@ -213,6 +212,14 @@ void main() {
WebSocketConnector:
()
=>
(
String
url
,
{
CompressionOptions
compression
})
async
=>
throw
const
SocketException
(
'test'
),
});
testUsingContext
(
'closing VMService closes Peer'
,
()
async
{
final
MockPeer
mockPeer
=
MockPeer
();
final
VMService
vmService
=
VMService
(
mockPeer
,
null
,
null
,
null
,
null
,
null
,
MockDevice
(),
null
);
expect
(
mockPeer
.
isClosed
,
equals
(
false
));
await
vmService
.
close
();
expect
(
mockPeer
.
isClosed
,
equals
(
true
));
});
testUsingContext
(
'refreshViews'
,
()
{
FakeAsync
().
run
((
FakeAsync
time
)
{
bool
done
=
false
;
...
...
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