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

Side by Side Diff: pkg/analyzer/test/cancelable_future_test.dart

Issue 849863002: Replace @ReflectiveTestCase() with @reflectiveTest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 test.cancelable_future; 5 library test.cancelable_future;
6 6
7 import 'reflective_tests.dart'; 7 import 'reflective_tests.dart';
8 import 'package:analyzer/src/cancelable_future.dart'; 8 import 'package:analyzer/src/cancelable_future.dart';
9 import 'dart:async'; 9 import 'dart:async';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import 'package:watcher/src/utils.dart'; 11 import 'package:watcher/src/utils.dart';
12 12
13 void main() { 13 void main() {
14 groupSep = ' | '; 14 groupSep = ' | ';
15 runReflectiveTests(CancelableCompleterTests); 15 runReflectiveTests(CancelableCompleterTests);
16 runReflectiveTests(CancelableFutureTests); 16 runReflectiveTests(CancelableFutureTests);
17 } 17 }
18 18
19 @ReflectiveTestCase() 19 @reflectiveTest
20 class CancelableFutureTests { 20 class CancelableFutureTests {
21 Future test_defaultConstructor_returnValue() { 21 Future test_defaultConstructor_returnValue() {
22 Object obj = new Object(); 22 Object obj = new Object();
23 bool callbackInvoked = false; 23 bool callbackInvoked = false;
24 new CancelableFuture(() => obj).then((result) { 24 new CancelableFuture(() => obj).then((result) {
25 expect(callbackInvoked, isFalse); 25 expect(callbackInvoked, isFalse);
26 expect(result, same(obj)); 26 expect(result, same(obj));
27 callbackInvoked = true; 27 callbackInvoked = true;
28 }, onError: (error) { 28 }, onError: (error) {
29 fail('Expected successful completion'); 29 fail('Expected successful completion');
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Future test_value() { 133 Future test_value() {
134 Object obj = new Object(); 134 Object obj = new Object();
135 return new CancelableFuture.value(obj).then((result) { 135 return new CancelableFuture.value(obj).then((result) {
136 expect(result, same(obj)); 136 expect(result, same(obj));
137 }, onError: (error) { 137 }, onError: (error) {
138 fail('Expected successful completion'); 138 fail('Expected successful completion');
139 }); 139 });
140 } 140 }
141 } 141 }
142 142
143 @ReflectiveTestCase() 143 @reflectiveTest
144 class CancelableCompleterTests { 144 class CancelableCompleterTests {
145 CancelableCompleter<Object> completer; 145 CancelableCompleter<Object> completer;
146 int cancelCount = 0; 146 int cancelCount = 0;
147 147
148 void setUp() { 148 void setUp() {
149 completer = new CancelableCompleter<Object>(() { cancelCount++; }); 149 completer = new CancelableCompleter<Object>(() { cancelCount++; });
150 } 150 }
151 151
152 void test_initialState() { 152 void test_initialState() {
153 expect(completer.isCompleted, isFalse); 153 expect(completer.isCompleted, isFalse);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 fail('Expected error completion'); 388 fail('Expected error completion');
389 }, onError: (error) { 389 }, onError: (error) {
390 expect(error, new isInstanceOf<FutureCanceledError>()); 390 expect(error, new isInstanceOf<FutureCanceledError>());
391 // And make sure nothing else happens. 391 // And make sure nothing else happens.
392 }).then((_) => pumpEventQueue()).then((_) { 392 }).then((_) => pumpEventQueue()).then((_) {
393 expect(completer.isCompleted, isFalse); 393 expect(completer.isCompleted, isFalse);
394 expect(cancelCount, 1); 394 expect(cancelCount, 1);
395 }); 395 });
396 } 396 }
397 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698