Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'event_helper.dart'; | 10 import 'event_helper.dart'; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 StreamController c = new StreamController(sync: true); | 409 StreamController c = new StreamController(sync: true); |
| 410 Expect.isFalse(c.isClosed); | 410 Expect.isFalse(c.isClosed); |
| 411 c.add(42); | 411 c.add(42); |
| 412 Expect.isFalse(c.isClosed); | 412 Expect.isFalse(c.isClosed); |
| 413 c.addError("bad"); | 413 c.addError("bad"); |
| 414 Expect.isFalse(c.isClosed); | 414 Expect.isFalse(c.isClosed); |
| 415 c.close(); | 415 c.close(); |
| 416 Expect.isTrue(c.isClosed); | 416 Expect.isTrue(c.isClosed); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void testStreamEquals() { | |
| 420 StreamController c; | |
| 421 c = new StreamController(sync: false); | |
| 422 Expect.equals(c.stream, c.stream); | |
| 423 c = new StreamController(sync: true); | |
| 424 Expect.equals(c.stream, c.stream); | |
| 425 c = new StreamController(sync: false, onListen:(){}); | |
| 426 Expect.equals(c.stream, c.stream); | |
| 427 c = new StreamController(sync: true, onListen:(){}); | |
| 428 Expect.equals(c.stream, c.stream); | |
| 429 c = new StreamController.broadcast(sync: false); | |
| 430 Expect.equals(c.stream, c.stream); | |
| 431 c = new StreamController.broadcast(sync: true); | |
| 432 Expect.equals(c.stream, c.stream); | |
| 433 c = new StreamController.broadcast(sync: false, onListen:(){}); | |
| 434 Expect.equals(c.stream, c.stream); | |
| 435 c = new StreamController.broadcast(sync: true, onListen:(){}); | |
|
floitsch
2013/07/19 11:47:40
maybe add test where it doesn't return true?
| |
| 436 Expect.equals(c.stream, c.stream); | |
| 437 } | |
| 438 | |
| 419 main() { | 439 main() { |
| 420 testMultiController(); | 440 testMultiController(); |
| 421 testSingleController(); | 441 testSingleController(); |
| 422 testExtraMethods(); | 442 testExtraMethods(); |
| 423 testClosed(); | 443 testClosed(); |
| 444 testStreamEquals(); | |
| 424 } | 445 } |
| OLD | NEW |