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

Side by Side Diff: pkg/analysis_testing/lib/mocks.dart

Issue 376693002: Extract testing utilities into a separate package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 library testing.mocks;
6
7 import 'package:analyzer/src/generated/element.dart';
8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:typed_mock/typed_mock.dart';
11
12
13 class MockAnalysisContext extends StringTypedMock implements AnalysisContext {
14 MockAnalysisContext(String name) : super(name);
15 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
16 }
17
18
19 class MockCompilationUnitElement extends TypedMock implements
20 CompilationUnitElement {
21 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
22 }
23
24
25 class MockElement extends StringTypedMock implements Element {
26 MockElement([String name = '<element>']) : super(name);
27 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
28 }
29
30
31 class MockHtmlElement extends TypedMock implements HtmlElement {
32 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
33 }
34
35
36 class MockLibraryElement extends TypedMock implements LibraryElement {
37 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
38 }
39
40
41 class MockLogger extends TypedMock implements Logger {
42 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
43 }
44
45
46 class MockSource extends StringTypedMock implements Source {
47 MockSource([String name = 'mocked.dart']) : super(name);
48 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
49 }
50
51
52 class StringTypedMock extends TypedMock {
53 String _toString;
54
55 StringTypedMock(this._toString);
56
57 @override
58 String toString() {
59 if (_toString != null) {
60 return _toString;
61 }
62 return super.toString();
63 }
64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698