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

Side by Side Diff: pkg/analysis_server/test/mocks.dart

Issue 944013003: Issue 22492. Increase number of event pumping cycles. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | pkg/pkg.status » ('j') | 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) 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 mocks; 5 library mocks;
6 6
7 @MirrorsUsed(targets: 'mocks', override: '*') 7 @MirrorsUsed(targets: 'mocks', override: '*')
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 * A [Matcher] that check that the given [Response] has an expected identifier 51 * A [Matcher] that check that the given [Response] has an expected identifier
52 * and no error. 52 * and no error.
53 */ 53 */
54 Matcher isResponseSuccess(String id) => new _IsResponseSuccess(id); 54 Matcher isResponseSuccess(String id) => new _IsResponseSuccess(id);
55 55
56 /** 56 /**
57 * Returns a [Future] that completes after pumping the event queue [times] 57 * Returns a [Future] that completes after pumping the event queue [times]
58 * times. By default, this should pump the event queue enough times to allow 58 * times. By default, this should pump the event queue enough times to allow
59 * any code to run, as long as it's not waiting on some external event. 59 * any code to run, as long as it's not waiting on some external event.
60 */ 60 */
61 Future pumpEventQueue([int times = 50]) { 61 Future pumpEventQueue([int times = 500]) {
62 if (times == 0) return new Future.value(); 62 if (times == 0) return new Future.value();
63 // We use a delayed future to allow microtask events to finish. The 63 // We use a delayed future to allow microtask events to finish. The
64 // Future.value or Future() constructors use scheduleMicrotask themselves and 64 // Future.value or Future() constructors use scheduleMicrotask themselves and
65 // would therefore not wait for microtask callbacks that are scheduled after 65 // would therefore not wait for microtask callbacks that are scheduled after
66 // invoking this method. 66 // invoking this method.
67 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); 67 return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
68 } 68 }
69 69
70 typedef void MockServerOperationPerformFunction(AnalysisServer server); 70 typedef void MockServerOperationPerformFunction(AnalysisServer server);
71 71
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 return mismatchDescription; 479 return mismatchDescription;
480 } 480 }
481 481
482 @override 482 @override
483 bool matches(item, Map matchState) { 483 bool matches(item, Map matchState) {
484 Response response = item; 484 Response response = item;
485 return response != null && response.id == _id && response.error == null; 485 return response != null && response.id == _id && response.error == null;
486 } 486 }
487 } 487 }
OLDNEW
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698