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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
7 | 7 |
8 import 'package:analyzer_plugin/protocol/generated_protocol.dart'; | 8 import 'package:analyzer_plugin/protocol/generated_protocol.dart'; |
9 import 'package:analyzer_plugin/protocol/protocol.dart'; | 9 import 'package:analyzer_plugin/protocol/protocol.dart'; |
10 import 'package:analyzer_plugin/src/channel/isolate_channel.dart'; | 10 import 'package:analyzer_plugin/src/channel/isolate_channel.dart'; |
11 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 | 13 |
14 void main() { | 14 void main() { |
15 defineReflectiveTests(IsolateChannelTest); | 15 defineReflectiveTests(PluginIsolateChannelTest); |
16 } | 16 } |
17 | 17 |
18 @reflectiveTest | 18 @reflectiveTest |
19 class IsolateChannelTest { | 19 class PluginIsolateChannelTest { |
20 TestSendPort sendPort; | 20 TestSendPort sendPort; |
21 IsolateChannel channel; | 21 PluginIsolateChannel channel; |
22 | 22 |
23 void setUp() { | 23 void setUp() { |
24 sendPort = new TestSendPort(); | 24 sendPort = new TestSendPort(); |
25 channel = new IsolateChannel(sendPort); | 25 channel = new PluginIsolateChannel(sendPort); |
26 } | 26 } |
27 | 27 |
28 void tearDown() { | 28 void tearDown() { |
29 // If the test doesn't listen to the channel, then close will not cancel the | 29 // If the test doesn't listen to the channel, then close will not cancel the |
30 // subscription and the process will not terminate. | 30 // subscription and the process will not terminate. |
31 try { | 31 try { |
32 channel.listen((request) {}); | 32 channel.listen((request) {}); |
33 } catch (exception) { | 33 } catch (exception) { |
34 // Ignore the exception if the test has already registered a listener. | 34 // Ignore the exception if the test has already registered a listener. |
35 } | 35 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (message is SendPort) { | 110 if (message is SendPort) { |
111 receivePort = message; | 111 receivePort = message; |
112 } else { | 112 } else { |
113 fail('Did not receive a receive port as the first communication.'); | 113 fail('Did not receive a receive port as the first communication.'); |
114 } | 114 } |
115 } else { | 115 } else { |
116 sentMessages.add(message); | 116 sentMessages.add(message); |
117 } | 117 } |
118 } | 118 } |
119 } | 119 } |
OLD | NEW |