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

Side by Side Diff: dart/frog/leg/lib/mock.dart

Issue 9420001: Various mocks and tweaks to reduce cancels in Leg. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « dart/frog/leg/lib/coreimpl.dart ('k') | dart/frog/leg/lib/mockimpl.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 (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 // Mocks of things that Leg cannot read directly.
6
7 // TODO(ahe): Remove this file.
8
9 interface Exception default ExceptionImplementation {
10 const Exception([var msg]);
11 }
12 class IndexOutOfRangeException implements Exception {}
13 class IllegalAccessException implements Exception {}
14 class ClosureArgumentMismatchException implements Exception {}
15 class ObjectNotClosureException implements Exception {}
16 class IllegalArgumentException implements Exception {}
17 class OutOfMemoryException implements Exception {}
18 class StackOverflowException implements Exception {}
19 class BadNumberFormatException implements Exception {}
20 class WrongArgumentCountException implements Exception {}
21 class NullPointerException implements Exception {}
22 class NoMoreElementsException implements Exception {}
23 class EmptyQueueException implements Exception {}
24 class UnsupportedOperationException implements Exception {}
25 class NotImplementedException implements Exception {}
26 class IllegalJSRegExpException implements Exception {}
27 class IntegerDivisionByZeroException implements Exception {}
28
29 class AssertionError {}
30 class TypeError extends AssertionError {}
31 class FallThroughError {}
32
33 // TODO(ahe): VM specfic exception?
34 class InternalError {}
35
36 // TODO(ahe): VM specfic exception?
37 class StaticResolutionException implements Exception {}
38
39 class NoSuchMethodException implements Exception {
40 Object receiver;
41 String name;
42 List args;
43 NoSuchMethodException(Object this.receiver, String this.name, List this.args);
44 String toString() {
45 return "NoSuchMethodException - receiver: '$receiver'" +
46 "function name: '$name' arguments: [$args]";
47 }
48 }
49
50 class List<E> implements Iterable<E> {
51 factory List([int length]) => Primitives.newList(length);
52 factory List.from(Iterable<E> other) {
53 throw 'List.from is not implemented';
54 }
55 }
56
57 class Stopwatch {
58 double startMs;
59 double elapsedMs;
60
61 Stopwatch() {
62 elapsedMs = 0.0;
63 }
64
65 void start() {
66 if (startMs == null) {
67 startMs = Primitives.dateNow();
68 }
69 }
70
71 void stop() {
72 if (startMs == null) return;
73 elapsedMs += Primitives.dateNow() - startMs;
74 startMs = null;
75 }
76
77 void reset() {
78 elapsedMs = 0.0;
79 if (startMs == null) return;
80 startMs = Primitives.dateNow();
81 }
82
83 int elapsed() {
84 return elapsedInMs();
85 }
86
87 int elapsedInUs() {
88 return elapsedInMs() * 1000;
89 }
90
91 int elapsedInMs() {
92 if (startMs == null) {
93 return Primitives.mathFloor(elapsedMs);
94 } else {
95 return Primitives.mathFloor(elapsedMs + (Primitives.dateNow() - startMs));
96 }
97 }
98
99 int frequency() {
100 return 1000;
101 }
102 }
103
104 void assert(condition) {}
OLDNEW
« no previous file with comments | « dart/frog/leg/lib/coreimpl.dart ('k') | dart/frog/leg/lib/mockimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698