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
723bc768
Unverified
Commit
723bc768
authored
Apr 13, 2020
by
Jonah Williams
Committed by
GitHub
Apr 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] update coverage collector to use vmservice api (#54682)
parent
14cceefe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
11 deletions
+16
-11
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+8
-7
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+5
-0
coverage_collector_test.dart
...ter_tools/test/general.shard/coverage_collector_test.dart
+3
-4
No files found.
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
723bc768
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'package:coverage/coverage.dart'
as
coverage
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
...
...
@@ -201,7 +202,13 @@ Future<Map<String, dynamic>> _getAllCoverage(VMService service, bool Function(St
final
List
<
Map
<
String
,
dynamic
>>
coverage
=
<
Map
<
String
,
dynamic
>>[];
for
(
final
Isolate
isolateRef
in
service
.
vm
.
isolates
)
{
await
isolateRef
.
load
();
final
Map
<
String
,
dynamic
>
scriptList
=
await
isolateRef
.
invokeRpcRaw
(
'getScripts'
,
params:
<
String
,
dynamic
>{
'isolateId'
:
isolateRef
.
id
});
Map
<
String
,
Object
>
scriptList
;
try
{
final
vm_service
.
ScriptList
actualScriptList
=
await
service
.
getScripts
(
isolateRef
.
id
);
scriptList
=
actualScriptList
.
json
;
}
on
vm_service
.
SentinelException
{
continue
;
}
final
List
<
Future
<
void
>>
futures
=
<
Future
<
void
>>[];
final
Map
<
String
,
Map
<
String
,
dynamic
>>
scripts
=
<
String
,
Map
<
String
,
dynamic
>>{};
...
...
@@ -209,12 +216,6 @@ Future<Map<String, dynamic>> _getAllCoverage(VMService service, bool Function(St
// For each ScriptRef loaded into the VM, load the corresponding Script and
// SourceReport object.
// We may receive such objects as
// {type: Sentinel, kind: Collected, valueAsString: <collected>}
// that need to be skipped.
if
(
scriptList
[
'scripts'
]
==
null
)
{
continue
;
}
for
(
final
Map
<
String
,
dynamic
>
script
in
(
scriptList
[
'scripts'
]
as
List
<
dynamic
>).
cast
<
Map
<
String
,
dynamic
>>())
{
if
(!
libraryPredicate
(
script
[
'uri'
]
as
String
))
{
continue
;
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
723bc768
...
...
@@ -492,6 +492,11 @@ class VMService implements vm_service.VmService {
_getEventController
(
streamId
).
add
(
event
);
}
@override
Future
<
vm_service
.
ScriptList
>
getScripts
(
String
isolateId
)
{
return
_delegateService
.
getScripts
(
isolateId
);
}
/// Reloads the VM.
Future
<
void
>
getVMOld
()
async
=>
await
vm
.
reload
();
...
...
packages/flutter_tools/test/general.shard/coverage_collector_test.dart
View file @
723bc768
...
...
@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/base/io.dart';
import
'package:flutter_tools/src/test/coverage_collector.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
import
'../src/common.dart'
;
...
...
@@ -19,10 +20,8 @@ void main() {
});
test
(
'Coverage collector Can handle coverage sentinenl data'
,
()
async
{
when
(
mockVMService
.
vm
.
isolates
.
first
.
invokeRpcRaw
(
'getScripts'
,
params:
anyNamed
(
'params'
)))
.
thenAnswer
((
Invocation
invocation
)
async
{
return
<
String
,
Object
>{
'type'
:
'Sentinel'
,
'kind'
:
'Collected'
,
'valueAsString'
:
'<collected>'
};
});
when
(
mockVMService
.
getScripts
(
any
))
.
thenThrow
(
vm_service
.
SentinelException
.
parse
(
'getScripts'
,
<
String
,
Object
>{}));
final
Map
<
String
,
Object
>
result
=
await
collect
(
null
,
(
String
predicate
)
=>
true
,
connector:
(
Uri
uri
)
async
{
return
mockVMService
;
});
...
...
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