hot_reload_test.dart 1.4 KB
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2018 The Chromium 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:file/file.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:vm_service_client/vm_service_client.dart';

9
import '../src/common.dart';
10 11
import 'test_data/basic_project.dart';
import 'test_driver.dart';
12
import 'test_utils.dart';
13 14

void main() {
15
  group('hot', () {
16
    Directory tempDir;
17
    final BasicProject _project = BasicProject();
18 19
    FlutterTestDriver _flutter;

20
    setUp(() async {
21
      tempDir = createResolvedTempDirectorySync();
22
      await _project.setUpIn(tempDir);
23
      _flutter = FlutterTestDriver(tempDir);
24 25 26
    });

    tearDown(() async {
27 28
      await _flutter.stop();
      tryToDelete(tempDir);
29 30
    });

31
    test('reload works without error', () async {
32
      await _flutter.run();
33
      await _flutter.hotReload();
34
    });
35

36 37 38
    test('restart works without error', () async {
      await _flutter.run();
      await _flutter.hotRestart();
39
    });
40

41
    test('reload hits breakpoints after reload', () async {
42
      await _flutter.run(withDebugger: true);
43
      final VMIsolate isolate = await _flutter.breakAt(
44
          _project.breakpointUri,
45
          _project.breakpointLine);
46
      expect(isolate.pauseEvent, isInstanceOf<VMPauseBreakpointEvent>());
47
    });
48
  }, timeout: const Timeout.factor(6));
49
}