default_streams_test.dart 1.19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 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 'dart:developer' as developer;

import 'package:flutter_test/flutter_test.dart';
import 'package:vm_service/vm_service.dart';
import 'package:vm_service/vm_service_io.dart';

// This test ensures that the engine starts the VM with the timeline streams
// for "Dart", "Embedder", and "GC" recorded from startup.

void main() {
15
  late VmService vmService;
16 17 18 19 20 21 22 23 24

  setUpAll(() async {
    final developer.ServiceProtocolInfo info = await developer.Service.getInfo();

    if (info.serverUri == null) {
      fail('This test _must_ be run with --enable-vmservice.');
    }

    vmService = await vmServiceConnectUri(
25
      'ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws',
26 27 28
    );
  });

29 30
  tearDownAll(() async {
    await vmService.dispose();
31 32 33 34 35 36 37 38 39
  });

  test('Image cache tracing', () async {
    final TimelineFlags flags = await vmService.getVMTimelineFlags();
    expect(flags.recordedStreams, containsAll(<String>[
      'Dart',
      'Embedder',
      'GC',
    ]));
40
  }, skip: isBrowser); // [intended] uses dart:isolate and io.
41
}