2018-07-10 05:51:12 +00:00
|
|
|
// 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';
|
|
|
|
|
2018-08-15 03:33:58 +00:00
|
|
|
import '../src/common.dart';
|
2018-07-10 05:51:12 +00:00
|
|
|
import 'test_data/basic_project.dart';
|
|
|
|
import 'test_driver.dart';
|
2018-10-19 11:51:31 +00:00
|
|
|
import 'test_utils.dart';
|
2018-07-10 05:51:12 +00:00
|
|
|
|
|
|
|
void main() {
|
2018-09-04 15:24:10 +00:00
|
|
|
group('hot', () {
|
2018-08-17 20:17:23 +00:00
|
|
|
Directory tempDir;
|
2018-09-12 06:29:29 +00:00
|
|
|
final BasicProject _project = BasicProject();
|
2018-08-17 20:17:23 +00:00
|
|
|
FlutterTestDriver _flutter;
|
|
|
|
|
2018-07-10 05:51:12 +00:00
|
|
|
setUp(() async {
|
2018-10-19 11:51:31 +00:00
|
|
|
tempDir = createResolvedTempDirectorySync();
|
2018-07-10 05:51:12 +00:00
|
|
|
await _project.setUpIn(tempDir);
|
2018-09-12 06:29:29 +00:00
|
|
|
_flutter = FlutterTestDriver(tempDir);
|
2018-07-10 05:51:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tearDown(() async {
|
2018-08-17 20:17:23 +00:00
|
|
|
await _flutter.stop();
|
|
|
|
tryToDelete(tempDir);
|
2018-07-10 05:51:12 +00:00
|
|
|
});
|
|
|
|
|
2018-09-04 15:24:10 +00:00
|
|
|
test('reload works without error', () async {
|
2018-07-10 05:51:12 +00:00
|
|
|
await _flutter.run();
|
2018-08-01 16:50:38 +00:00
|
|
|
await _flutter.hotReload();
|
2018-08-30 19:08:23 +00:00
|
|
|
});
|
2018-07-10 05:51:12 +00:00
|
|
|
|
2018-09-04 15:24:10 +00:00
|
|
|
test('restart works without error', () async {
|
|
|
|
await _flutter.run();
|
|
|
|
await _flutter.hotRestart();
|
2018-10-02 17:31:55 +00:00
|
|
|
});
|
2018-09-04 15:24:10 +00:00
|
|
|
|
2018-10-19 11:51:31 +00:00
|
|
|
test('reload hits breakpoints after reload', () async {
|
2018-07-10 05:51:12 +00:00
|
|
|
await _flutter.run(withDebugger: true);
|
2018-08-01 16:50:38 +00:00
|
|
|
final VMIsolate isolate = await _flutter.breakAt(
|
2018-10-24 06:21:48 +00:00
|
|
|
_project.breakpointUri,
|
2018-08-01 16:50:38 +00:00
|
|
|
_project.breakpointLine);
|
2018-08-15 03:33:58 +00:00
|
|
|
expect(isolate.pauseEvent, isInstanceOf<VMPauseBreakpointEvent>());
|
2018-09-13 05:35:21 +00:00
|
|
|
});
|
2018-10-16 19:57:07 +00:00
|
|
|
}, timeout: const Timeout.factor(6));
|
2018-07-10 05:51:12 +00:00
|
|
|
}
|