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

Side by Side Diff: tests/language_2/async_star_no_cancel_test.dart

Issue 2986093002: Revert two Kernel changes that were causing test failures. (Closed)
Patch Set: Revert "Migrate language/async_backwards... ... language/async_star_take..." Created 3 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import "dart:async";
6 import "package:expect/expect.dart";
7 import "package:async_helper/async_helper.dart";
8
9 var events = [];
10
11 ticker() async* {
12 var sc;
13 var sentTickCount = 0;
14 sc = new StreamController(onListen: () {
15 events.add("listen");
16 }, onCancel: () {
17 events.add("cancel");
18 });
19
20 try {
21 var counter = 0;
22 await for (var tick in sc.stream) {
23 counter++;
24 }
25 } finally {
26 events.add("finally");
27 }
28 }
29
30 void main() {
31 asyncStart();
32 events.add("main");
33 final subscription = ticker().listen((val) {});
34
35 bool cancelFinished = false;
36 // Cancel the subscription.
37 // The async* function is blocked on an `await` (the inner stream) and won't
38 // be able to complete.
39 Timer.run(() {
40 events.add("invoke cancel");
41 subscription.cancel().then((_) => cancelFinished = true);
42 });
43
44 new Timer(const Duration(milliseconds: 100), () {
45 Expect.isFalse(cancelFinished);
46 Expect.listEquals(["main", "listen", "invoke cancel"], events);
47 asyncEnd();
48 });
49 }
OLDNEW
« no previous file with comments | « tests/language_2/async_star_no_cancel2_test.dart ('k') | tests/language_2/async_star_pause_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698