| 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 testing.mock_sdk; | 5 library testing.mock_sdk; |
| 6 | 6 |
| 7 import 'package:analyzer/file_system/file_system.dart' as resource; | 7 import 'package:analyzer/file_system/file_system.dart' as resource; |
| 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; | 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; |
| 9 import 'package:analyzer/src/context/context.dart'; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 MockSdk() { | 213 MockSdk() { |
| 214 LIBRARIES.forEach((_MockSdkLibrary library) { | 214 LIBRARIES.forEach((_MockSdkLibrary library) { |
| 215 provider.newFile(library.path, library.content); | 215 provider.newFile(library.path, library.content); |
| 216 }); | 216 }); |
| 217 } | 217 } |
| 218 | 218 |
| 219 @override | 219 @override |
| 220 AnalysisContext get context { | 220 AnalysisContext get context { |
| 221 if (_analysisContext == null) { | 221 if (_analysisContext == null) { |
| 222 _analysisContext = new SdkAnalysisContext(); | 222 _analysisContext = new SdkAnalysisContext(null); |
| 223 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); | 223 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); |
| 224 _analysisContext.sourceFactory = factory; | 224 _analysisContext.sourceFactory = factory; |
| 225 } | 225 } |
| 226 return _analysisContext; | 226 return _analysisContext; |
| 227 } | 227 } |
| 228 | 228 |
| 229 @override | 229 @override |
| 230 List<SdkLibrary> get sdkLibraries => LIBRARIES; | 230 List<SdkLibrary> get sdkLibraries => LIBRARIES; |
| 231 | 231 |
| 232 @override | 232 @override |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 bool get isInternal => shortName.startsWith('dart:_'); | 332 bool get isInternal => shortName.startsWith('dart:_'); |
| 333 | 333 |
| 334 @override | 334 @override |
| 335 bool get isShared => throw unimplemented; | 335 bool get isShared => throw unimplemented; |
| 336 | 336 |
| 337 @override | 337 @override |
| 338 bool get isVmLibrary => throw unimplemented; | 338 bool get isVmLibrary => throw unimplemented; |
| 339 | 339 |
| 340 UnimplementedError get unimplemented => new UnimplementedError(); | 340 UnimplementedError get unimplemented => new UnimplementedError(); |
| 341 } | 341 } |
| OLD | NEW |