| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Integration test that runs the incremental compiler, runs the compiled | 5 /// Integration test that runs the incremental compiler, runs the compiled |
| 6 /// program, incrementally rebuild portions of the app, and triggers a hot | 6 /// program, incrementally rebuild portions of the app, and triggers a hot |
| 7 /// reload on the running program. | 7 /// reload on the running program. |
| 8 library front_end.incremental.hot_reload_e2e_test; | 8 library front_end.incremental.hot_reload_e2e_test; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 setUp(() async { | 34 setUp(() async { |
| 35 outDir = Directory.systemTemp.createTempSync('hotreload_test'); | 35 outDir = Directory.systemTemp.createTempSync('hotreload_test'); |
| 36 outputUri = outDir.uri.resolve('test.dill'); | 36 outputUri = outDir.uri.resolve('test.dill'); |
| 37 fs = new MemoryFileSystem(Uri.parse('file:///')); | 37 fs = new MemoryFileSystem(Uri.parse('file:///')); |
| 38 writeFile(fs, 'a.dart', sourceA); | 38 writeFile(fs, 'a.dart', sourceA); |
| 39 writeFile(fs, 'b.dart', sourceB); | 39 writeFile(fs, 'b.dart', sourceB); |
| 40 writeFile(fs, '.packages', ''); | 40 writeFile(fs, '.packages', ''); |
| 41 compiler = await createIncrementalCompiler( | 41 compiler = await createIncrementalCompiler( |
| 42 'file:///a.dart', new HybridFileSystem(fs)); | 42 'file:///a.dart', new HybridFileSystem(fs)); |
| 43 await rebuild(compiler, outputUri); // this is a full compile. | 43 await rebuild(compiler, outputUri); // this is a full compile. |
| 44 compiler.acceptLastDelta(); |
| 44 }); | 45 }); |
| 45 | 46 |
| 46 tearDown(() async { | 47 tearDown(() async { |
| 47 outDir.deleteSync(recursive: true); | 48 outDir.deleteSync(recursive: true); |
| 48 lines = null; | 49 lines = null; |
| 49 }); | 50 }); |
| 50 | 51 |
| 51 Future<int> computeVmPort() async { | 52 Future<int> computeVmPort() async { |
| 52 var portLine = await lines[0]; | 53 var portLine = await lines[0]; |
| 53 expect(observatoryPortRegExp.hasMatch(portLine), isTrue); | 54 expect(observatoryPortRegExp.hasMatch(portLine), isTrue); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 programIsDone = vm.exitCode; | 99 programIsDone = vm.exitCode; |
| 99 await resume(); | 100 await resume(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 /// Request a hot reload on the running program. | 103 /// Request a hot reload on the running program. |
| 103 Future hotReload() async { | 104 Future hotReload() async { |
| 104 var port = await computeVmPort(); | 105 var port = await computeVmPort(); |
| 105 var remoteVm = new RemoteVm(port); | 106 var remoteVm = new RemoteVm(port); |
| 106 var reloadResult = await remoteVm.reload(outputUri); | 107 var reloadResult = await remoteVm.reload(outputUri); |
| 107 expect(reloadResult['success'], isTrue); | 108 expect(reloadResult['success'], isTrue); |
| 109 compiler.acceptLastDelta(); |
| 108 await remoteVm.disconnect(); | 110 await remoteVm.disconnect(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 test('initial program is valid', () async { | 113 test('initial program is valid', () async { |
| 112 await startProgram(0); | 114 await startProgram(0); |
| 113 await programIsDone; | 115 await programIsDone; |
| 114 expect(await lines[1], "part1 part2"); | 116 expect(await lines[1], "part1 part2"); |
| 115 }); | 117 }); |
| 116 | 118 |
| 117 test('reload after leaf library modification', () async { | 119 test('reload after leaf library modification', () async { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 241 |
| 240 f() => "$line part2"; | 242 f() => "$line part2"; |
| 241 '''; | 243 '''; |
| 242 | 244 |
| 243 const sourceB = r''' | 245 const sourceB = r''' |
| 244 get line => "part1"; | 246 get line => "part1"; |
| 245 '''; | 247 '''; |
| 246 | 248 |
| 247 RegExp observatoryPortRegExp = | 249 RegExp observatoryPortRegExp = |
| 248 new RegExp("Observatory listening on http://127.0.0.1:\([0-9]*\)/"); | 250 new RegExp("Observatory listening on http://127.0.0.1:\([0-9]*\)/"); |
| OLD | NEW |