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

Unified Diff: pkg/analysis_server/test/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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/mocks.dart
diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
index 4fe4e96587de6f1225241833d54a6a43af719f4c..5f381f71286d630dbd520799f64760dc8c561ade 100644
--- a/pkg/analysis_server/test/mocks.dart
+++ b/pkg/analysis_server/test/mocks.dart
@@ -304,121 +304,6 @@ class _IsResponseFailure extends Matcher {
}
}
-class MockSdk implements DartSdk {
-
- final resource.MemoryResourceProvider provider = new resource.MemoryResourceProvider();
-
- MockSdk() {
- // TODO(paulberry): Add to this as needed.
- const Map<String, String> pathToContent = const {
- "/lib/core/core.dart": '''
- library dart.core;
- class Object {}
- class Function {}
- class StackTrace {}
- class Symbol {}
- class Type {}
-
- class String extends Object {}
- class bool extends Object {}
- abstract class num extends Object {
- num operator +(num other);
- num operator -(num other);
- num operator *(num other);
- num operator /(num other);
- }
- abstract class int extends num {
- int operator -();
- }
- class double extends num {}
- class DateTime extends Object {}
- class Null extends Object {}
-
- class Deprecated extends Object {
- final String expires;
- const Deprecated(this.expires);
- }
- const Object deprecated = const Deprecated("next release");
-
- abstract class List<E> extends Object {
- void add(E value);
- E operator [](int index);
- void operator []=(int index, E value);
- }
- class Map<K, V> extends Object {}
-
- void print(Object object) {}
- ''',
-
- "/lib/html/dartium/html_dartium.dart": '''
- library dart.html;
- class HtmlElement {}
- ''',
-
- "/lib/math/math.dart": '''
- library dart.math;
- '''
- };
-
- pathToContent.forEach((String path, String content) {
- provider.newFile(path, content);
- });
- }
-
- // Not used
- @override
- AnalysisContext get context => throw unimplemented;
-
- @override
- Source fromEncoding(UriKind kind, Uri uri) {
- resource.Resource file = provider.getResource(uri.path);
- if (file is resource.File) {
- return file.createSource(kind);
- }
- return null;
- }
-
- UnimplementedError get unimplemented => new UnimplementedError();
-
- @override
- SdkLibrary getSdkLibrary(String dartUri) {
- // getSdkLibrary() is only used to determine whether a library is internal
- // to the SDK. The mock SDK doesn't have any internals, so it's safe to
- // return null.
- return null;
- }
-
- @override
- Source mapDartUri(String dartUri) {
- const Map<String, String> uriToPath = const {
- "dart:core": "/lib/core/core.dart",
- "dart:html": "/lib/html/dartium/html_dartium.dart",
- "dart:math": "/lib/math/math.dart"
- };
-
- String path = uriToPath[dartUri];
- if (path != null) {
- resource.File file = provider.getResource(path);
- return file.createSource(UriKind.DART_URI);
- }
-
- // If we reach here then we tried to use a dartUri that's not in the
- // table above.
- throw unimplemented;
- }
-
- // Not used.
- @override
- List<SdkLibrary> get sdkLibraries => throw unimplemented;
-
- // Not used.
- @override
- String get sdkVersion => throw unimplemented;
-
- // Not used.
- @override
- List<String> get uris => throw unimplemented;
-}
/**
* A mock [PackageMapProvider].

Powered by Google App Engine
This is Rietveld 408576698