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

Side by Side Diff: quiver/lib/testing/src/async/async.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « quiver/lib/testing/runtime.dart ('k') | quiver/lib/testing/src/async/fake_async.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 part of quiver.testing.async;
16
17 /**
18 * DEPRECATED: Use a much more feature-rich FakeAsync instead.
19 *
20 * A [Timer] implementation that stores its duration and callback for access
21 * in tests.
22 */
23 @deprecated
24 class FakeTimer implements Timer {
25 Duration duration;
26 var callback;
27 var onCancel;
28
29 /**
30 * Sets this timers [duration] and [callback] and returns [this].
31 *
32 * This method is usable as a [CreateTimer] or [CreateTimerPeriodic]
33 * function. In tests, construct a FakeTimer so that you have a refernece to
34 * it, then pass [create] to the function or class under test.
35 */
36 FakeTimer create(Duration duration, callback) {
37 if (this.duration != null) {
38 throw new StateError("FakeTimer.create already called");
39 }
40 this.duration = duration;
41 this.callback = callback;
42 return this;
43 }
44
45 void cancel() {
46 if (onCancel != null) onCancel();
47 }
48
49 bool isActive = true;
50 }
OLDNEW
« no previous file with comments | « quiver/lib/testing/runtime.dart ('k') | quiver/lib/testing/src/async/fake_async.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698