2019-11-27 23:04:02 +00:00
|
|
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
2019-06-27 18:17:58 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
import 'package:flutter_tools/src/test/coverage_collector.dart';
|
2020-04-13 23:10:02 +00:00
|
|
|
import 'package:vm_service/vm_service.dart' as vm_service;
|
2019-06-27 18:17:58 +00:00
|
|
|
|
2019-07-13 18:51:44 +00:00
|
|
|
import '../src/common.dart';
|
2019-06-27 18:17:58 +00:00
|
|
|
|
|
|
|
void main() {
|
2020-04-29 18:52:46 +00:00
|
|
|
testWithoutContext('Coverage collector Can handle coverage SentinelException', () async {
|
|
|
|
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
|
|
|
|
requests: <VmServiceExpectation>[
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
method: 'getVM',
|
|
|
|
jsonResponse: (vm_service.VM.parse(<String, Object>{})
|
|
|
|
..isolates = <vm_service.IsolateRef>[
|
|
|
|
vm_service.IsolateRef.parse(<String, Object>{
|
|
|
|
'id': '1'
|
|
|
|
}),
|
|
|
|
]
|
|
|
|
).toJson(),
|
|
|
|
),
|
|
|
|
const FakeVmServiceRequest(
|
|
|
|
method: 'getScripts',
|
|
|
|
args: <String, Object>{
|
|
|
|
'isolateId': '1',
|
|
|
|
},
|
|
|
|
jsonResponse: <String, Object>{
|
|
|
|
'type': 'Sentinel'
|
|
|
|
}
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
|
|
|
|
final Map<String, Object> result = await collect(
|
|
|
|
null,
|
|
|
|
(String predicate) => true,
|
|
|
|
connector: (Uri uri) async {
|
|
|
|
return fakeVmServiceHost.vmService;
|
|
|
|
},
|
|
|
|
);
|
2019-06-27 18:17:58 +00:00
|
|
|
|
|
|
|
expect(result, <String, Object>{'type': 'CodeCoverage', 'coverage': <Object>[]});
|
2020-04-29 18:52:46 +00:00
|
|
|
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
2019-06-27 18:17:58 +00:00
|
|
|
});
|
|
|
|
}
|