OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
9 | 9 |
10 import 'package:unittest/src/backend/invoker.dart'; | 10 import 'package:unittest/src/backend/invoker.dart'; |
11 import 'package:unittest/src/backend/live_test.dart'; | 11 import 'package:unittest/src/backend/live_test.dart'; |
| 12 import 'package:unittest/src/backend/metadata.dart'; |
12 import 'package:unittest/src/backend/state.dart'; | 13 import 'package:unittest/src/backend/state.dart'; |
13 import 'package:unittest/src/backend/suite.dart'; | 14 import 'package:unittest/src/backend/suite.dart'; |
14 import 'package:unittest/src/runner/vm/isolate_listener.dart'; | 15 import 'package:unittest/src/runner/vm/isolate_listener.dart'; |
15 import 'package:unittest/src/runner/vm/isolate_test.dart'; | 16 import 'package:unittest/src/runner/vm/isolate_test.dart'; |
16 import 'package:unittest/src/util/io.dart'; | 17 import 'package:unittest/src/util/io.dart'; |
17 import 'package:unittest/src/util/remote_exception.dart'; | 18 import 'package:unittest/src/util/remote_exception.dart'; |
18 import 'package:unittest/unittest.dart'; | 19 import 'package:unittest/unittest.dart'; |
19 | 20 |
20 import '../utils.dart'; | 21 import '../utils.dart'; |
21 | 22 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 /// Loads the first test defined in [entryPoint] in another isolate. | 267 /// Loads the first test defined in [entryPoint] in another isolate. |
267 /// | 268 /// |
268 /// This test will be automatically closed when the test is finished. | 269 /// This test will be automatically closed when the test is finished. |
269 Future<LiveTest> _isolateTest(void entryPoint(SendPort sendPort)) { | 270 Future<LiveTest> _isolateTest(void entryPoint(SendPort sendPort)) { |
270 return _spawnIsolate(entryPoint).then((receivePort) { | 271 return _spawnIsolate(entryPoint).then((receivePort) { |
271 return receivePort.first; | 272 return receivePort.first; |
272 }).then((response) { | 273 }).then((response) { |
273 expect(response, containsPair("type", "success")); | 274 expect(response, containsPair("type", "success")); |
274 | 275 |
275 var testMap = response["tests"].first; | 276 var testMap = response["tests"].first; |
276 var test = new IsolateTest(testMap["name"], testMap["sendPort"]); | 277 var metadata = new Metadata.deserialize(testMap["metadata"]); |
| 278 var test = new IsolateTest(testMap["name"], metadata, testMap["sendPort"]); |
277 var suite = new Suite([test]); | 279 var suite = new Suite([test]); |
278 _liveTest = test.load(suite); | 280 _liveTest = test.load(suite); |
279 return _liveTest; | 281 return _liveTest; |
280 }); | 282 }); |
281 } | 283 } |
282 | 284 |
283 /// Spawns an isolate from [entryPoint], sends it a new [SendPort], and returns | 285 /// Spawns an isolate from [entryPoint], sends it a new [SendPort], and returns |
284 /// the corresponding [ReceivePort]. | 286 /// the corresponding [ReceivePort]. |
285 /// | 287 /// |
286 /// This isolate will be automatically killed when the test is finished. | 288 /// This isolate will be automatically killed when the test is finished. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 IsolateListener.start(sendPort, () => () { | 373 IsolateListener.start(sendPort, () => () { |
372 test("multiple errors", () { | 374 test("multiple errors", () { |
373 Invoker.current.addOutstandingCallback(); | 375 Invoker.current.addOutstandingCallback(); |
374 new Future(() => throw "one"); | 376 new Future(() => throw "one"); |
375 new Future(() => throw "two"); | 377 new Future(() => throw "two"); |
376 new Future(() => throw "three"); | 378 new Future(() => throw "three"); |
377 new Future(() => throw "four"); | 379 new Future(() => throw "four"); |
378 }); | 380 }); |
379 }); | 381 }); |
380 } | 382 } |
OLD | NEW |