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

Side by Side Diff: test/runner/isolate_listener_test.dart

Issue 979523002: Move more files around. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 9 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 | « test/runner/engine_test.dart ('k') | test/runner/loader_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 7
8 import 'package:unittest/src/backend/invoker.dart'; 8 import 'package:unittest/src/backend/invoker.dart';
9 import 'package:unittest/src/backend/live_test.dart'; 9 import 'package:unittest/src/backend/live_test.dart';
10 import 'package:unittest/src/backend/state.dart'; 10 import 'package:unittest/src/backend/state.dart';
11 import 'package:unittest/src/backend/suite.dart'; 11 import 'package:unittest/src/backend/suite.dart';
12 import 'package:unittest/src/runner/isolate_test.dart'; 12 import 'package:unittest/src/runner/vm/isolate_listener.dart';
13 import 'package:unittest/src/runner/vm_listener.dart'; 13 import 'package:unittest/src/runner/vm/isolate_test.dart';
14 import 'package:unittest/src/util/io.dart'; 14 import 'package:unittest/src/util/io.dart';
15 import 'package:unittest/src/util/remote_exception.dart'; 15 import 'package:unittest/src/util/remote_exception.dart';
16 import 'package:unittest/unittest.dart'; 16 import 'package:unittest/unittest.dart';
17 17
18 import 'utils.dart'; 18 import '../utils.dart';
19 19
20 /// An isolate that's been spun up for the current test. 20 /// An isolate that's been spun up for the current test.
21 /// 21 ///
22 /// This is tracked so that it can be killed once the test is done. 22 /// This is tracked so that it can be killed once the test is done.
23 Isolate _isolate; 23 Isolate _isolate;
24 24
25 /// A live test that's running for the current test. 25 /// A live test that's running for the current test.
26 /// 26 ///
27 /// This is tracked so that it can be closed once the test is done. 27 /// This is tracked so that it can be closed once the test is done.
28 LiveTest _liveTest; 28 LiveTest _liveTest;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 Future<ReceivePort> _spawnIsolate(void entryPoint(SendPort sendPort)) { 285 Future<ReceivePort> _spawnIsolate(void entryPoint(SendPort sendPort)) {
286 var receivePort = new ReceivePort(); 286 var receivePort = new ReceivePort();
287 return Isolate.spawn(entryPoint, receivePort.sendPort).then((isolate) { 287 return Isolate.spawn(entryPoint, receivePort.sendPort).then((isolate) {
288 _isolate = isolate; 288 _isolate = isolate;
289 return receivePort; 289 return receivePort;
290 }); 290 });
291 } 291 }
292 292
293 /// An isolate entrypoint that throws immediately. 293 /// An isolate entrypoint that throws immediately.
294 void _loadError(SendPort sendPort) => 294 void _loadError(SendPort sendPort) =>
295 VmListener.start(sendPort, () => () => throw 'oh no'); 295 IsolateListener.start(sendPort, () => () => throw 'oh no');
296 296
297 /// An isolate entrypoint that throws a NoSuchMethodError. 297 /// An isolate entrypoint that throws a NoSuchMethodError.
298 void _noSuchMethodError(SendPort sendPort) { 298 void _noSuchMethodError(SendPort sendPort) {
299 return VmListener.start(sendPort, () => 299 return IsolateListener.start(sendPort, () =>
300 throw new NoSuchMethodError(null, #main, [], {})); 300 throw new NoSuchMethodError(null, #main, [], {}));
301 } 301 }
302 302
303 /// An isolate entrypoint that returns a non-function. 303 /// An isolate entrypoint that returns a non-function.
304 void _nonFunction(SendPort sendPort) => 304 void _nonFunction(SendPort sendPort) =>
305 VmListener.start(sendPort, () => null); 305 IsolateListener.start(sendPort, () => null);
306 306
307 /// An isolate entrypoint that returns a function with the wrong arity. 307 /// An isolate entrypoint that returns a function with the wrong arity.
308 void _wrongArity(SendPort sendPort) => 308 void _wrongArity(SendPort sendPort) =>
309 VmListener.start(sendPort, () => (_) {}); 309 IsolateListener.start(sendPort, () => (_) {});
310 310
311 /// An isolate entrypoint that defines three tests that succeed. 311 /// An isolate entrypoint that defines three tests that succeed.
312 void _successfulTests(SendPort sendPort) { 312 void _successfulTests(SendPort sendPort) {
313 VmListener.start(sendPort, () => () { 313 IsolateListener.start(sendPort, () => () {
314 test("successful 1", () {}); 314 test("successful 1", () {});
315 test("successful 2", () {}); 315 test("successful 2", () {});
316 test("successful 3", () {}); 316 test("successful 3", () {});
317 }); 317 });
318 } 318 }
319 319
320 /// An isolate entrypoint that defines a test that fails. 320 /// An isolate entrypoint that defines a test that fails.
321 void _failingTest(SendPort sendPort) { 321 void _failingTest(SendPort sendPort) {
322 VmListener.start(sendPort, () => () { 322 IsolateListener.start(sendPort, () => () {
323 test("failure", () => throw new TestFailure('oh no')); 323 test("failure", () => throw new TestFailure('oh no'));
324 }); 324 });
325 } 325 }
326 326
327 /// An isolate entrypoint that defines a test that fails after succeeding. 327 /// An isolate entrypoint that defines a test that fails after succeeding.
328 void _failAfterSucceedTest(SendPort sendPort) { 328 void _failAfterSucceedTest(SendPort sendPort) {
329 VmListener.start(sendPort, () => () { 329 IsolateListener.start(sendPort, () => () {
330 test("fail after succeed", () { 330 test("fail after succeed", () {
331 pumpEventQueue().then((_) { 331 pumpEventQueue().then((_) {
332 throw new TestFailure('oh no'); 332 throw new TestFailure('oh no');
333 }); 333 });
334 }); 334 });
335 }); 335 });
336 } 336 }
337 337
338 /// An isolate entrypoint that defines a test that fails multiple times. 338 /// An isolate entrypoint that defines a test that fails multiple times.
339 void _multiFailTest(SendPort sendPort) { 339 void _multiFailTest(SendPort sendPort) {
340 VmListener.start(sendPort, () => () { 340 IsolateListener.start(sendPort, () => () {
341 test("multiple failures", () { 341 test("multiple failures", () {
342 Invoker.current.addOutstandingCallback(); 342 Invoker.current.addOutstandingCallback();
343 new Future(() => throw new TestFailure("one")); 343 new Future(() => throw new TestFailure("one"));
344 new Future(() => throw new TestFailure("two")); 344 new Future(() => throw new TestFailure("two"));
345 new Future(() => throw new TestFailure("three")); 345 new Future(() => throw new TestFailure("three"));
346 new Future(() => throw new TestFailure("four")); 346 new Future(() => throw new TestFailure("four"));
347 }); 347 });
348 }); 348 });
349 } 349 }
350 350
351 /// An isolate entrypoint that defines a test that errors. 351 /// An isolate entrypoint that defines a test that errors.
352 void _errorTest(SendPort sendPort) { 352 void _errorTest(SendPort sendPort) {
353 VmListener.start(sendPort, () => () { 353 IsolateListener.start(sendPort, () => () {
354 test("error", () => throw 'oh no'); 354 test("error", () => throw 'oh no');
355 }); 355 });
356 } 356 }
357 357
358 /// An isolate entrypoint that defines a test that errors after succeeding. 358 /// An isolate entrypoint that defines a test that errors after succeeding.
359 void _errorAfterSucceedTest(SendPort sendPort) { 359 void _errorAfterSucceedTest(SendPort sendPort) {
360 VmListener.start(sendPort, () => () { 360 IsolateListener.start(sendPort, () => () {
361 test("error after succeed", () { 361 test("error after succeed", () {
362 pumpEventQueue().then((_) => throw 'oh no'); 362 pumpEventQueue().then((_) => throw 'oh no');
363 }); 363 });
364 }); 364 });
365 } 365 }
366 366
367 /// An isolate entrypoint that defines a test that errors multiple times. 367 /// An isolate entrypoint that defines a test that errors multiple times.
368 void _multiErrorTest(SendPort sendPort) { 368 void _multiErrorTest(SendPort sendPort) {
369 VmListener.start(sendPort, () => () { 369 IsolateListener.start(sendPort, () => () {
370 test("multiple errors", () { 370 test("multiple errors", () {
371 Invoker.current.addOutstandingCallback(); 371 Invoker.current.addOutstandingCallback();
372 new Future(() => throw "one"); 372 new Future(() => throw "one");
373 new Future(() => throw "two"); 373 new Future(() => throw "two");
374 new Future(() => throw "three"); 374 new Future(() => throw "three");
375 new Future(() => throw "four"); 375 new Future(() => throw "four");
376 }); 376 });
377 }); 377 });
378 } 378 }
OLDNEW
« no previous file with comments | « test/runner/engine_test.dart ('k') | test/runner/loader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698