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

Unified Diff: quiver/lib/testing/src/time/time.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « quiver/lib/testing/src/runtime/checked_mode.dart ('k') | quiver/lib/testing/time.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: quiver/lib/testing/src/time/time.dart
diff --git a/quiver/lib/testing/src/time/time.dart b/quiver/lib/testing/src/time/time.dart
deleted file mode 100644
index 01049cfdd60c64b11f4b30fb161337c82f88ee82..0000000000000000000000000000000000000000
--- a/quiver/lib/testing/src/time/time.dart
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-part of quiver.testing.time;
-
-/**
- * Returns the current test time in microseconds.
- */
-typedef int Now();
-
-/**
- * A [Stopwatch] implementation that gets the current time in microseconds
- * via a user-supplied function.
- */
-class FakeStopwatch implements Stopwatch {
- Now _now;
- int frequency;
- int _start;
- int _stop;
-
- FakeStopwatch(int now(), int this.frequency)
- : _now = now,
- _start = null,
- _stop = null;
-
- void start() {
- if (isRunning) return;
- if (_start == null) {
- _start = _now();
- } else {
- _start = _now() - (_stop - _start);
- _stop = null;
- }
- }
-
- void stop() {
- if (!isRunning) return;
- _stop = _now();
- }
-
- void reset() {
- if (_start == null) return;
- _start = _now();
- if (_stop != null) {
- _stop = _start;
- }
- }
-
- int get elapsedTicks {
- if (_start == null) {
- return 0;
- }
- return (_stop == null) ? (_now() - _start) : (_stop - _start);
- }
-
- Duration get elapsed => new Duration(microseconds: elapsedMicroseconds);
-
- int get elapsedMicroseconds => (elapsedTicks * 1000000) ~/ frequency;
-
- int get elapsedMilliseconds => (elapsedTicks * 1000) ~/ frequency;
-
- bool get isRunning => _start != null && _stop == null;
-}
« no previous file with comments | « quiver/lib/testing/src/runtime/checked_mode.dart ('k') | quiver/lib/testing/time.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698