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

Unified Diff: pkg/analyzer/test/src/context/mock_sdk.dart

Issue 2657533004: Update MockSdk to be more consistent with the actual SDK, switch x_Driver tests to it. (Closed)
Patch Set: Created 3 years, 11 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 | « pkg/analyzer/test/generated/resolver_test_case.dart ('k') | pkg/analyzer/test/src/dart/analysis/base.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/context/mock_sdk.dart
diff --git a/pkg/analyzer/test/src/context/mock_sdk.dart b/pkg/analyzer/test/src/context/mock_sdk.dart
index d12cd77441f03e6eab1dda255ebcd913e47e05c3..9ac7c6852facefd59fafada4d525039592cf2e19 100644
--- a/pkg/analyzer/test/src/context/mock_sdk.dart
+++ b/pkg/analyzer/test/src/context/mock_sdk.dart
@@ -66,9 +66,26 @@ abstract class Completer<T> {
const <String, String>{
'$sdkRoot/lib/async/stream.dart': r'''
part of dart.async;
+
class Stream<T> {
Future<T> get first;
+ StreamSubscription<T> listen(void onData(T event),
+ { Function onError,
+ void onDone(),
+ bool cancelOnError});
+}
+
+abstract class StreamSubscription<T> {
+ Future cancel();
+ void onData(void handleData(T data));
+ void onError(Function handleError);
+ void onDone(void handleDone());
+ void pause([Future resumeSignal]);
+ void resume();
+ bool get isPaused;
+ Future<E> asFuture<E>([E futureValue]);
}
+
abstract class StreamTransformer<S, T> {}
'''
});
@@ -106,11 +123,19 @@ class Object {
bool operator ==(other) => identical(this, other);
String toString() => 'a string';
int get hashCode => 0;
+ Type get runtimeType => null;
+ dynamic noSuchMethod(Invocation invocation) => null;
}
class Function {}
class StackTrace {}
-class Symbol {}
+
+class Symbol {
+ const factory Symbol(String name) {
+ return null;
+ }
+}
+
class Type {}
abstract class Comparable<T> {
@@ -126,6 +151,7 @@ abstract class String implements Comparable<String>, Pattern {
bool get isNotEmpty => false;
int get length => 0;
String substring(int len) => null;
+ String toLowerCase();
String toUpperCase();
List<int> get codeUnits;
}
@@ -133,7 +159,13 @@ abstract class RegExp implements Pattern {
external factory RegExp(String source);
}
-class bool extends Object {}
+class bool extends Object {
+ external const factory bool.fromEnvironment(String name,
+ {bool defaultValue: false});
+}
+
+abstract class Invocation {}
+
abstract class num implements Comparable<num> {
bool operator <(num other);
bool operator <=(num other);
@@ -144,21 +176,33 @@ abstract class num implements Comparable<num> {
num operator *(num other);
num operator /(num other);
int operator ^(int other);
- int operator &(int other);
int operator |(int other);
int operator <<(int other);
int operator >>(int other);
int operator ~/(num other);
num operator %(num other);
int operator ~();
+ num operator -();
int toInt();
double toDouble();
num abs();
int round();
}
abstract class int extends num {
+ external const factory int.fromEnvironment(String name, {int defaultValue});
+
+ bool get isNegative;
bool get isEven => false;
+
+ int operator &(int other);
+ int operator |(int other);
+ int operator ^(int other);
+ int operator ~();
+ int operator <<(int shiftAmount);
+ int operator >>(int shiftAmount);
+
int operator -();
+
external static int parse(String source,
{ int radix,
int onError(String source) });
@@ -194,7 +238,12 @@ abstract class double extends num {
}
class DateTime extends Object {}
-class Null extends Object {}
+
+class Null extends Object {
+ factory Null._uninstantiable() {
+ throw new UnsupportedError('class Null cannot be instantiated');
+ }
+}
class Deprecated extends Object {
final String expires;
@@ -233,6 +282,7 @@ class List<E> implements Iterable<E> {
bool get isEmpty => false;
E get first => null;
+ E get last => null;
Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e)) => null;
@@ -242,9 +292,11 @@ class List<E> implements Iterable<E> {
}
class Map<K, V> extends Object {
- Iterable<K> get keys => null;
V operator [](K key) => null;
void operator []=(K key, V value) {}
+ Iterable<K> get keys => null;
+ int get length;
+ Iterable<V> get values;
}
external bool identical(Object a, Object b);
@@ -282,7 +334,22 @@ const _MockSdkLibrary _LIB_HTML_DARTIUM = const _MockSdkLibrary(
'$sdkRoot/lib/html/dartium/html_dartium.dart',
'''
library dart.html;
-class HtmlElement {}
+
+abstract class HtmlElement {}
+
+abstract class CanvasElement extends HtmlElement {
+ Object getContext(String contextId, [Map attributes]);
+ CanvasRenderingContext2D get context2D;
+}
+
+abstract class class CanvasRenderingContext2D {}
+''');
+
+const _MockSdkLibrary _LIB_INTERCEPTORS = const _MockSdkLibrary(
+ 'dart:_interceptors',
+ '$sdkRoot/lib/_internal/js_runtime/lib/interceptors.dart',
+ '''
+library dart._interceptors;
''');
const _MockSdkLibrary _LIB_MATH = const _MockSdkLibrary(
@@ -317,6 +384,7 @@ const List<SdkLibrary> _LIBRARIES = const [
_LIB_MATH,
_LIB_HTML_DART2JS,
_LIB_HTML_DARTIUM,
+ _LIB_INTERCEPTORS,
];
class MockSdk implements DartSdk {
@@ -328,6 +396,8 @@ class MockSdk implements DartSdk {
"dart:collection": "$sdkRoot/lib/collection/collection.dart",
"dart:convert": "$sdkRoot/lib/convert/convert.dart",
"dart:_foreign_helper": "$sdkRoot/lib/_foreign_helper/_foreign_helper.dart",
+ "dart:_interceptors":
+ "$sdkRoot/lib/_internal/js_runtime/lib/interceptors.dart",
"dart:math": "$sdkRoot/lib/math/math.dart"
};
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test_case.dart ('k') | pkg/analyzer/test/src/dart/analysis/base.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698