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

Side by Side Diff: tests/lib/async/stream_controller_test.dart

Issue 271273005: Fix typo in test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Test the basic StreamController and StreamController.singleSubscription. 5 // Test the basic StreamController and StreamController.singleSubscription.
6 library stream_controller_test; 6 library stream_controller_test;
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 Expect.equals(c.stream, c.stream); 435 Expect.equals(c.stream, c.stream);
436 c = new StreamController.broadcast(sync: false, onListen:(){}); 436 c = new StreamController.broadcast(sync: false, onListen:(){});
437 Expect.equals(c.stream, c.stream); 437 Expect.equals(c.stream, c.stream);
438 c = new StreamController.broadcast(sync: true, onListen:(){}); 438 c = new StreamController.broadcast(sync: true, onListen:(){});
439 Expect.equals(c.stream, c.stream); 439 Expect.equals(c.stream, c.stream);
440 } 440 }
441 441
442 void testCancelThrow() { 442 void testCancelThrow() {
443 asyncStart(); 443 asyncStart();
444 asyncStart(); 444 asyncStart();
445 asyncStart();
445 StreamController c = new StreamController(onCancel: () { 446 StreamController c = new StreamController(onCancel: () {
446 asyncEnd(); 447 asyncEnd();
447 throw "ERROR"; 448 throw "ERROR";
448 }); 449 });
449 c.add(1); 450 c.add(1);
450 c.add(2); 451 c.add(2);
451 c.add(3); 452 c.add(3);
452 Future done = c.close(); 453 Future done = c.close();
453 StreamSubscription sub; 454 StreamSubscription sub;
454 sub = c.stream.listen((v) { 455 sub = c.stream.listen((v) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 497 }
497 498
498 void testCancelThrow3() { 499 void testCancelThrow3() {
499 asyncStart(); 500 asyncStart();
500 asyncStart(); 501 asyncStart();
501 asyncStart(); 502 asyncStart();
502 asyncStart(); 503 asyncStart();
503 asyncStart(); 504 asyncStart();
504 asyncStart(); 505 asyncStart();
505 StreamController c2 = new StreamController(onCancel: () { 506 StreamController c2 = new StreamController(onCancel: () {
506 asyneEnd(); 507 asyncEnd();
507 throw "ERROR2"; 508 throw "ERROR2";
508 }); 509 });
509 c2.add(1); 510 c2.add(1);
510 c2.add(2); 511 c2.add(2);
511 var done2 = c2.close(); 512 var done2 = c2.close();
512 done2.catchError(fail).whenComplete(asyncEnd); // Should not get error; 513 done2.catchError(fail).whenComplete(asyncEnd); // Should not get error;
513 514
514 StreamController c = new StreamController(onCancel: () { 515 StreamController c = new StreamController(onCancel: () {
515 asyncEnd(); 516 asyncEnd();
516 throw "ERROR1"; 517 throw "ERROR1";
517 }); 518 });
518 var sub; 519 var sub;
519 sub = c.stream.listen((v) { 520 sub = c.stream.listen((v) {
520 Expect.equals(1, v); 521 Expect.equals(1, v);
521 Future f = sub.cancel(); 522 Future f = sub.cancel();
522 f.catchError((e) { 523 f.catchError((e) {
523 // Only the last error ends up here. 524 // Only the last error ends up here.
524 Expect.equals("ERROR1", e); 525 Expect.equals("ERROR1", e);
525 asyncEnd(); 526 asyncEnd();
526 }); 527 });
527 }); 528 });
528 var addDone = c.addStream(c2.stream); 529 var addDone = c.addStream(c2.stream);
529 addDone.catchError(fail).whenComplete(asyncEnd); // Error must not go here. 530 addDone.catchError(fail).whenComplete(asyncEnd); // Error must not go here.
530 c.done.catchError(fail).whenComplete(asyncEnd); // Error must not go here. 531 c.done.catchError(fail).whenComplete(asyncEnd); // Error must not go here.
531 } 532 }
532 533
533 main() { 534 main() {
535 asyncStart();
534 testMultiController(); 536 testMultiController();
535 testSingleController(); 537 testSingleController();
536 testExtraMethods(); 538 testExtraMethods();
537 testClosed(); 539 testClosed();
538 testStreamEquals(); 540 testStreamEquals();
539 testCancelThrow(); 541 testCancelThrow();
540 testCancelThrow2(); 542 testCancelThrow2();
541 testCancelThrow3(); 543 testCancelThrow3();
544 asyncEnd();
542 } 545 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698