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

Side by Side Diff: tests/language/async_star_test.dart

Issue 1000083003: Remove a test that is incredibly flaky on some platforms. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 | 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) 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 library async_start_test; 5 library async_start_test;
6 6
7 import "package:unittest/unittest.dart"; 7 import "package:unittest/unittest.dart";
8 import "dart:async"; 8 import "dart:async";
9 9
10 main() { 10 main() {
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 done.complete(); 697 done.complete();
698 } 698 }
699 }, onDone: () { 699 }, onDone: () {
700 fail("Unexpected done!"); 700 fail("Unexpected done!");
701 }); 701 });
702 return done.future.whenComplete(() { 702 return done.future.whenComplete(() {
703 expect(list.length == 18 || list.length == 19, isTrue); 703 expect(list.length == 18 || list.length == 19, isTrue);
704 }); 704 });
705 }); 705 });
706 706
707 test("multiple pauses, cancel while paused", () {
708 var list = [];
709 f() async* {
710 int i = 0;
711 while (true) {
712 yield i;
713 list.add(i);
714 i++;
715 await null; // extra pause for good measure.
716 }
717 }
718 int expected = 0;
719 var done = new Completer();
720 var sub;
721 sub = f().listen((v) {
722 expect(v, equals(expected++));
723 if (v == 5) {
724 scheduleMicrotask(() {
725 sub.pause();
726 sub.resume();
727 sub.pause();
728 sub.resume();
729 sub.pause();
730 sub.resume();
731 });
732 } else if (v == 6) {
733 sub.pause();
734 new Timer(MS * 300, () {
735 expect(list.length, lessThan(8));
736 sub.cancel();
737 done.complete();
738 });
739 }
740 }, onDone: () {
741 fail("Unexpected done");
742 });
743 });
744
745 test("canceling while paused at yield", () { /// 02: ok 707 test("canceling while paused at yield", () { /// 02: ok
746 var list = []; /// 02: contin ued 708 var list = []; /// 02: contin ued
747 var sync = new Sync(); /// 02: contin ued 709 var sync = new Sync(); /// 02: contin ued
748 f() async* { /// 02: contin ued 710 f() async* { /// 02: contin ued
749 list.add("*1"); /// 02: contin ued 711 list.add("*1"); /// 02: contin ued
750 yield 1; /// 02: contin ued 712 yield 1; /// 02: contin ued
751 await sync.wait(); /// 02: contin ued 713 await sync.wait(); /// 02: contin ued
752 sync.release(); /// 02: contin ued 714 sync.release(); /// 02: contin ued
753 list.add("*2"); /// 02: contin ued 715 list.add("*2"); /// 02: contin ued
754 yield 2; /// 02: contin ued 716 yield 2; /// 02: contin ued
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 } 913 }
952 914
953 // Release whoever is currently waiting. 915 // Release whoever is currently waiting.
954 void release([v]) { 916 void release([v]) {
955 if (_completer != null) { 917 if (_completer != null) {
956 _completer.complete(v); 918 _completer.complete(v);
957 _completer = null; 919 _completer = null;
958 } 920 }
959 } 921 }
960 } 922 }
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