Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: tests/fletchc/driver/test_vm_connection.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/fletchc/driver/test_control_stream.dart ('k') | tests/fletchc/incremental/common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
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.md file.
4
5 /// Used for testing compiler/debugger session when VM socket is closed
6 /// unexpectedly.
7 library fletchc.test.client.test_vm_connection;
8
9 import 'dart:async' show
10 Future;
11
12 import 'dart:io' show
13 InternetAddress;
14
15 import 'dart:isolate' show
16 SendPort;
17
18 import 'package:expect/expect.dart' show
19 Expect;
20
21 import 'package:fletchc/src/hub/session_manager.dart' show
22 SessionState;
23
24 import 'package:fletchc/src/worker/developer.dart' show
25 attachToVm;
26
27 import 'package:fletchc/vm_commands.dart' show
28 VmCommandCode;
29
30 import '../run.dart' show
31 FletchRunner;
32
33 import 'mock_vm.dart' show
34 MockVm;
35
36 class MockVmRunner extends FletchRunner {
37 final bool closeImmediately;
38 final VmCommandCode closeAfterFirst;
39
40 MockVm vm;
41
42 MockVmRunner({this.closeImmediately: false, this.closeAfterFirst});
43
44 Future<Null> attach(SessionState state) async {
45 vm = await MockVm.spawn(
46 closeImmediately: closeImmediately, closeAfterFirst: closeAfterFirst);
47 await attachToVm(InternetAddress.LOOPBACK_IP_V4.address, vm.port, state);
48 }
49
50 Future<int> run(List<String> arguments, {int expectedExitCode: 0}) async {
51 await super.run(arguments);
52 int exitCode = await vm.exitCode;
53 print("Mock VM exit code: $exitCode");
54 return exitCode;
55 }
56 }
57
58 main(List<String> arguments) async {
59 await new MockVmRunner().run(arguments);
60 }
61
62 Future<Null> test() => main(<String>['tests/language/application_test.dart']);
63
64 Future<Null> testCloseImmediately() async {
65 int result = await new MockVmRunner(closeImmediately: true)
66 .run(<String>['tests/language/application_test.dart']);
67 // TODO(ahe): The actual exit code is TBD.
68 Expect.equals(1, result);
69 }
70
71 Future<Null> testCloseAfterCommitChanges() async {
72 int result =
73 await new MockVmRunner(closeAfterFirst: VmCommandCode.CommitChanges)
74 .run(<String>['tests/language/application_test.dart']);
75 // TODO(ahe): The actual exit code is TBD.
76 Expect.equals(1, result);
77 }
78
79 Future<Null> testCloseAfterProcessRun() async {
80 int result = await new MockVmRunner(closeAfterFirst: VmCommandCode.ProcessRun)
81 .run(<String>['tests/language/application_test.dart']);
82 // TODO(ahe): The actual exit code is TBD.
83 Expect.equals(1, result);
84 }
OLDNEW
« no previous file with comments | « tests/fletchc/driver/test_control_stream.dart ('k') | tests/fletchc/incremental/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698