// Copyright 2014 The Flutter Authors. All rights reserved. // 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'; import 'package:vm_service/vm_service.dart' as vm_service; import '../src/common.dart'; void main() { testWithoutContext('Coverage collector Can handle coverage SentinelException', () async { final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost( requests: [ FakeVmServiceRequest( id: '1', method: 'getVM', args: null, jsonResponse: (vm_service.VM.parse({}) ..isolates = [ vm_service.IsolateRef.parse({ 'id': '1' }), ] ).toJson(), ), const FakeVmServiceRequest( id: '2', method: 'getScripts', args: { 'isolateId': '1', }, jsonResponse: { 'type': 'Sentinel' } ) ], ); final Map result = await collect( null, (String predicate) => true, connector: (Uri uri) async { return fakeVmServiceHost.vmService; }, ); expect(result, {'type': 'CodeCoverage', 'coverage': []}); expect(fakeVmServiceHost.hasRemainingExpectations, false); }); }