Chromium Code Reviews

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

Issue 983573002: Add support for running browser tests to the test runner. (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.
Jump to:
View unified diff |
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';
(...skipping 254 matching lines...)
265 /// 265 ///
266 /// This test will be automatically closed when the test is finished. 266 /// This test will be automatically closed when the test is finished.
267 Future<LiveTest> _isolateTest(void entryPoint(SendPort sendPort)) { 267 Future<LiveTest> _isolateTest(void entryPoint(SendPort sendPort)) {
268 return _spawnIsolate(entryPoint).then((receivePort) { 268 return _spawnIsolate(entryPoint).then((receivePort) {
269 return receivePort.first; 269 return receivePort.first;
270 }).then((response) { 270 }).then((response) {
271 expect(response, containsPair("type", "success")); 271 expect(response, containsPair("type", "success"));
272 272
273 var testMap = response["tests"].first; 273 var testMap = response["tests"].first;
274 var test = new IsolateTest(testMap["name"], testMap["sendPort"]); 274 var test = new IsolateTest(testMap["name"], testMap["sendPort"]);
275 var suite = new Suite("suite", [test]); 275 var suite = new Suite([test]);
276 _liveTest = test.load(suite); 276 _liveTest = test.load(suite);
277 return _liveTest; 277 return _liveTest;
278 }); 278 });
279 } 279 }
280 280
281 /// Spawns an isolate from [entryPoint], sends it a new [SendPort], and returns 281 /// Spawns an isolate from [entryPoint], sends it a new [SendPort], and returns
282 /// the corresponding [ReceivePort]. 282 /// the corresponding [ReceivePort].
283 /// 283 ///
284 /// This isolate will be automatically killed when the test is finished. 284 /// This isolate will be automatically killed when the test is finished.
285 Future<ReceivePort> _spawnIsolate(void entryPoint(SendPort sendPort)) { 285 Future<ReceivePort> _spawnIsolate(void entryPoint(SendPort sendPort)) {
(...skipping 83 matching lines...)
369 IsolateListener.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

Powered by Google App Engine