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

Side by Side Diff: pkg/scheduled_test/test/utils.dart

Issue 13472016: Split apart several asynchronous tests to reduce timeouts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « pkg/scheduled_test/test/scheduled_test_test.dart ('k') | utils/tests/pub/oauth2/utils.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_utils; 5 library test_utils;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'package:scheduled_test/scheduled_test.dart';
10 import 'package:scheduled_test/src/utils.dart'; 11 import 'package:scheduled_test/src/utils.dart';
11 import 'package:scheduled_test/src/mock_clock.dart' as mock_clock; 12 import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
12 13
14 import 'metatest.dart';
15
13 export 'package:scheduled_test/src/utils.dart'; 16 export 'package:scheduled_test/src/utils.dart';
14 17
15 /// Wraps [input] to provide a timeout. If [input] completes before 18 /// Wraps [input] to provide a timeout. If [input] completes before
16 /// [milliseconds] have passed, then the return value completes in the same way. 19 /// [milliseconds] have passed, then the return value completes in the same way.
17 /// However, if [milliseconds] pass before [input] has completed, [onTimeout] is 20 /// However, if [milliseconds] pass before [input] has completed, [onTimeout] is
18 /// run and its result is passed to [input] (with chaining, if it returns a 21 /// run and its result is passed to [input] (with chaining, if it returns a
19 /// [Future]). 22 /// [Future]).
20 /// 23 ///
21 /// Note that timing out will not cancel the asynchronous operation behind 24 /// Note that timing out will not cancel the asynchronous operation behind
22 /// [input]. 25 /// [input].
(...skipping 15 matching lines...) Expand all
38 } 41 }
39 42
40 /// Returns a [Future] that will complete in [milliseconds]. 43 /// Returns a [Future] that will complete in [milliseconds].
41 Future sleep(int milliseconds) { 44 Future sleep(int milliseconds) {
42 var completer = new Completer(); 45 var completer = new Completer();
43 mock_clock.newTimer(new Duration(milliseconds: milliseconds), () { 46 mock_clock.newTimer(new Duration(milliseconds: milliseconds), () {
44 completer.complete(); 47 completer.complete();
45 }); 48 });
46 return completer.future; 49 return completer.future;
47 } 50 }
51
52 /// Sets up a timeout for every metatest in this file.
53 void setUpTimeout() {
54 metaSetUp(() {
55 // TODO(nweiz): We used to only increase the timeout to 10s for the Windows
56 // bots, but the Linux and Mac bots have started taking upwards of 5s when
57 // running pumpEventQueue, so we're increasing the timeout across the board
58 // (see issue 9248).
59 currentSchedule.timeout = new Duration(seconds: 10);
60 });
61 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/scheduled_test_test.dart ('k') | utils/tests/pub/oauth2/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698