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

Unified Diff: pkg/analyzer/test/cancelable_future_test.dart

Issue 1842563003: Format everything in analyzer (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/cancelable_future_test.dart
diff --git a/pkg/analyzer/test/cancelable_future_test.dart b/pkg/analyzer/test/cancelable_future_test.dart
index 24c84ae07dac984bc259c8b7045b3befcbc80e94..1ece1a5ff7d4954c1738cf8fec22d3f819f9f285 100644
--- a/pkg/analyzer/test/cancelable_future_test.dart
+++ b/pkg/analyzer/test/cancelable_future_test.dart
@@ -39,15 +39,18 @@ class CancelableCompleterTests {
completer.future.cancel();
expect(cancelCount, 1);
// Make sure the future still completes with error.
- return completer.future.then((_) {
- fail('Expected error completion');
- }, onError: (error) {
- expect(error, new isInstanceOf<FutureCanceledError>());
- // And make sure nothing else happens.
- }).then((_) => pumpEventQueue()).then((_) {
- expect(completer.isCompleted, isFalse);
- expect(cancelCount, 1);
- });
+ return completer.future
+ .then((_) {
+ fail('Expected error completion');
+ }, onError: (error) {
+ expect(error, new isInstanceOf<FutureCanceledError>());
+ // And make sure nothing else happens.
+ })
+ .then((_) => pumpEventQueue())
+ .then((_) {
+ expect(completer.isCompleted, isFalse);
+ expect(cancelCount, 1);
+ });
}
Future test_cancel_after_chaining() {
@@ -82,13 +85,16 @@ class CancelableCompleterTests {
// late to cancel.
expect(cancelCount, 0);
// Make sure the future still completes with the object.
- return completer.future.then((result) {
- expect(result, same(obj));
- // And make sure nothing else happens.
- }).then((_) => pumpEventQueue()).then((_) {
- expect(completer.isCompleted, isTrue);
- expect(cancelCount, 0);
- });
+ return completer.future
+ .then((result) {
+ expect(result, same(obj));
+ // And make sure nothing else happens.
+ })
+ .then((_) => pumpEventQueue())
+ .then((_) {
+ expect(completer.isCompleted, isTrue);
+ expect(cancelCount, 0);
+ });
}
Future test_cancel_before_chaining() {
@@ -126,15 +132,18 @@ class CancelableCompleterTests {
completer.complete(obj);
expect(completer.isCompleted, isTrue);
// Make sure the future still completer with error.
- return completer.future.then((_) {
- fail('Expected error completion');
- }, onError: (error) {
- expect(error, new isInstanceOf<FutureCanceledError>());
- // And make sure nothing else happens.
- }).then((_) => pumpEventQueue()).then((_) {
- expect(completer.isCompleted, isTrue);
- expect(cancelCount, 1);
- });
+ return completer.future
+ .then((_) {
+ fail('Expected error completion');
+ }, onError: (error) {
+ expect(error, new isInstanceOf<FutureCanceledError>());
+ // And make sure nothing else happens.
+ })
+ .then((_) => pumpEventQueue())
+ .then((_) {
+ expect(completer.isCompleted, isTrue);
+ expect(cancelCount, 1);
+ });
}
Future test_complete_after_chaining() {
@@ -150,16 +159,19 @@ class CancelableCompleterTests {
expect(completer.isCompleted, isFalse);
// Running the event loop should have no effect since the completer hasn't
// been completed yet.
- return pumpEventQueue().then((_) {
- completer.complete(obj);
- expect(completer.isCompleted, isTrue);
- // The callback should be deferred to a microtask.
- expect(callbackInvoked, isFalse);
- }).then((_) => pumpEventQueue()).then((_) {
- expect(callbackInvoked, isTrue);
- expect(completer.isCompleted, isTrue);
- expect(cancelCount, 0);
- });
+ return pumpEventQueue()
+ .then((_) {
+ completer.complete(obj);
+ expect(completer.isCompleted, isTrue);
+ // The callback should be deferred to a microtask.
+ expect(callbackInvoked, isFalse);
+ })
+ .then((_) => pumpEventQueue())
+ .then((_) {
+ expect(callbackInvoked, isTrue);
+ expect(completer.isCompleted, isTrue);
+ expect(cancelCount, 0);
+ });
}
void test_complete_after_complete() {
@@ -221,15 +233,18 @@ class CancelableCompleterTests {
completer.completeError(obj);
expect(completer.isCompleted, isTrue);
// Make sure the future still completes with error.
- return completer.future.then((_) {
- fail('Expected error completion');
- }, onError: (error) {
- expect(error, new isInstanceOf<FutureCanceledError>());
- // And make sure nothing else happens.
- }).then((_) => pumpEventQueue()).then((_) {
- expect(completer.isCompleted, isTrue);
- expect(cancelCount, 1);
- });
+ return completer.future
+ .then((_) {
+ fail('Expected error completion');
+ }, onError: (error) {
+ expect(error, new isInstanceOf<FutureCanceledError>());
+ // And make sure nothing else happens.
+ })
+ .then((_) => pumpEventQueue())
+ .then((_) {
+ expect(completer.isCompleted, isTrue);
+ expect(cancelCount, 1);
+ });
}
Future test_completeError_after_chaining() {
@@ -245,16 +260,19 @@ class CancelableCompleterTests {
expect(completer.isCompleted, isFalse);
// Running the event loop should have no effect since the completer hasn't
// been completed yet.
- return pumpEventQueue().then((_) {
- completer.completeError(obj);
- expect(completer.isCompleted, isTrue);
- // The callback should be deferred to a microtask.
- expect(callbackInvoked, isFalse);
- }).then((_) => pumpEventQueue()).then((_) {
- expect(callbackInvoked, isTrue);
- expect(completer.isCompleted, isTrue);
- expect(cancelCount, 0);
- });
+ return pumpEventQueue()
+ .then((_) {
+ completer.completeError(obj);
+ expect(completer.isCompleted, isTrue);
+ // The callback should be deferred to a microtask.
+ expect(callbackInvoked, isFalse);
+ })
+ .then((_) => pumpEventQueue())
+ .then((_) {
+ expect(callbackInvoked, isTrue);
+ expect(completer.isCompleted, isTrue);
+ expect(cancelCount, 0);
+ });
}
Future test_completeError_before_chaining() {
« no previous file with comments | « pkg/analyzer/lib/src/task/options_work_manager.dart ('k') | pkg/analyzer/test/generated/analysis_context_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698