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

Side by Side Diff: packages/quiver/lib/testing/src/time/time.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
OLDNEW
1 // Copyright 2013 Google Inc. All Rights Reserved. 1 // Copyright 2013 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 part of quiver.testing.time; 15 part of quiver.testing.time;
16 16
17 /** 17 /// Returns the current test time in microseconds.
18 * Returns the current test time in microseconds.
19 */
20 typedef int Now(); 18 typedef int Now();
21 19
22 /** 20 /// A [Stopwatch] implementation that gets the current time in microseconds
23 * A [Stopwatch] implementation that gets the current time in microseconds 21 /// via a user-supplied function.
24 * via a user-supplied function.
25 */
26 class FakeStopwatch implements Stopwatch { 22 class FakeStopwatch implements Stopwatch {
27 Now _now; 23 Now _now;
28 int frequency; 24 int frequency;
29 int _start; 25 int _start;
30 int _stop; 26 int _stop;
31 27
32 FakeStopwatch(int now(), int this.frequency) 28 FakeStopwatch(int now(), int this.frequency)
33 : _now = now, 29 : _now = now,
34 _start = null, 30 _start = null,
35 _stop = null; 31 _stop = null;
(...skipping 29 matching lines...) Expand all
65 } 61 }
66 62
67 Duration get elapsed => new Duration(microseconds: elapsedMicroseconds); 63 Duration get elapsed => new Duration(microseconds: elapsedMicroseconds);
68 64
69 int get elapsedMicroseconds => (elapsedTicks * 1000000) ~/ frequency; 65 int get elapsedMicroseconds => (elapsedTicks * 1000000) ~/ frequency;
70 66
71 int get elapsedMilliseconds => (elapsedTicks * 1000) ~/ frequency; 67 int get elapsedMilliseconds => (elapsedTicks * 1000) ~/ frequency;
72 68
73 bool get isRunning => _start != null && _stop == null; 69 bool get isRunning => _start != null && _stop == null;
74 } 70 }
OLDNEW
« no previous file with comments | « packages/quiver/lib/testing/src/runtime/checked_mode.dart ('k') | packages/quiver/lib/testing/time.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698