OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Library for creating mock versions of platform and internal libraries. | 5 // Library for creating mock versions of platform and internal libraries. |
6 | 6 |
7 library mock_libraries; | 7 library mock_libraries; |
8 | 8 |
9 String buildLibrarySource( | 9 String buildLibrarySource( |
10 Map<String, String> elementMap, | 10 Map<String, String> elementMap, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 }; | 93 }; |
94 | 94 |
95 const String DEFAULT_PATCH_CORE_SOURCE = r''' | 95 const String DEFAULT_PATCH_CORE_SOURCE = r''' |
96 import 'dart:_js_helper'; | 96 import 'dart:_js_helper'; |
97 import 'dart:_interceptors'; | 97 import 'dart:_interceptors'; |
98 import 'dart:_isolate_helper'; | 98 import 'dart:_isolate_helper'; |
99 import 'dart:async'; | 99 import 'dart:async'; |
100 '''; | 100 '''; |
101 | 101 |
102 const Map<String, String> DEFAULT_JS_HELPER_LIBRARY = const <String, String>{ | 102 const Map<String, String> DEFAULT_JS_HELPER_LIBRARY = const <String, String>{ |
| 103 'assertTest': 'assertTest(a) {}', |
| 104 'assertThrow': 'assertThrow(a) {}', |
103 'assertHelper': 'assertHelper(a) {}', | 105 'assertHelper': 'assertHelper(a) {}', |
104 'assertIsSubtype': 'assertIsSubtype(subtype, supertype, message) {}', | 106 'assertIsSubtype': 'assertIsSubtype(subtype, supertype, message) {}', |
105 'assertSubtype': 'assertSubtype(object, isField, checks, asField) {}', | 107 'assertSubtype': 'assertSubtype(object, isField, checks, asField) {}', |
106 'assertSubtypeOfRuntimeType': 'assertSubtypeOfRuntimeType(object, type) {}', | 108 'assertSubtypeOfRuntimeType': 'assertSubtypeOfRuntimeType(object, type) {}', |
107 'asyncHelper': 'asyncHelper(object, asyncBody, completer) {}', | 109 'asyncHelper': 'asyncHelper(object, asyncBody, completer) {}', |
108 'boolConversionCheck': 'boolConversionCheck(x) {}', | 110 'boolConversionCheck': 'boolConversionCheck(x) {}', |
109 'boolTypeCast': 'boolTypeCast(value) {}', | 111 'boolTypeCast': 'boolTypeCast(value) {}', |
110 'boolTypeCheck': 'boolTypeCheck(value) {}', | 112 'boolTypeCheck': 'boolTypeCheck(value) {}', |
111 'checkSubtype': 'checkSubtype(object, isField, checks, asField) {}', | 113 'checkSubtype': 'checkSubtype(object, isField, checks, asField) {}', |
112 'checkSubtypeOfRuntimeType': 'checkSubtypeOfRuntimeType(o, t) {}', | 114 'checkSubtypeOfRuntimeType': 'checkSubtypeOfRuntimeType(o, t) {}', |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 const Map<String, String> DEFAULT_ISOLATE_HELPER_LIBRARY = | 379 const Map<String, String> DEFAULT_ISOLATE_HELPER_LIBRARY = |
378 const <String, String>{ | 380 const <String, String>{ |
379 'startRootIsolate': 'void startRootIsolate(entry, args) {}', | 381 'startRootIsolate': 'void startRootIsolate(entry, args) {}', |
380 '_currentIsolate': 'var _currentIsolate;', | 382 '_currentIsolate': 'var _currentIsolate;', |
381 '_callInIsolate': 'var _callInIsolate;', | 383 '_callInIsolate': 'var _callInIsolate;', |
382 '_WorkerBase': 'class _WorkerBase {}', | 384 '_WorkerBase': 'class _WorkerBase {}', |
383 }; | 385 }; |
384 | 386 |
385 const Map<String, String> DEFAULT_ASYNC_LIBRARY = const <String, String>{ | 387 const Map<String, String> DEFAULT_ASYNC_LIBRARY = const <String, String>{ |
386 'DeferredLibrary': 'class DeferredLibrary {}', | 388 'DeferredLibrary': 'class DeferredLibrary {}', |
387 'Future': | 389 'Future': |
388 ''' | 390 ''' |
389 class Future<T> { | 391 class Future<T> { |
390 Future.value([value]); | 392 Future.value([value]); |
391 } | 393 } |
392 ''', | 394 ''', |
393 'Stream': 'class Stream<T> {}', | 395 'Stream': 'class Stream<T> {}', |
394 'Completer': 'class Completer<T> {}', | 396 'Completer': 'class Completer<T> {}', |
395 'StreamIterator': 'class StreamIterator<T> {}', | 397 'StreamIterator': 'class StreamIterator<T> {}', |
396 }; | 398 }; |
397 | 399 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 431 |
430 const LookupMap(this._entries, [this._nestedMaps = const []]) | 432 const LookupMap(this._entries, [this._nestedMaps = const []]) |
431 : _key = null, _value = null; | 433 : _key = null, _value = null; |
432 | 434 |
433 const LookupMap.pair(this._key, this._value) | 435 const LookupMap.pair(this._key, this._value) |
434 : _entries = const [], _nestedMaps = const []; | 436 : _entries = const [], _nestedMaps = const []; |
435 V operator[](K k) => null; | 437 V operator[](K k) => null; |
436 }''', | 438 }''', |
437 '_version': 'const _version = "0.0.1+1";', | 439 '_version': 'const _version = "0.0.1+1";', |
438 }; | 440 }; |
OLD | NEW |