| 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/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/sdk.dart'; | 10 import 'package:analyzer/src/generated/sdk.dart'; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 String path = uriToPath[dartUri]; | 208 String path = uriToPath[dartUri]; |
| 209 if (path != null) { | 209 if (path != null) { |
| 210 resource.File file = provider.getResource(path); | 210 resource.File file = provider.getResource(path); |
| 211 Uri uri = new Uri(scheme: 'dart', path: dartUri.substring(5)); | 211 Uri uri = new Uri(scheme: 'dart', path: dartUri.substring(5)); |
| 212 return file.createSource(uri); | 212 return file.createSource(uri); |
| 213 } | 213 } |
| 214 | 214 |
| 215 // If we reach here then we tried to use a dartUri that's not in the | 215 // If we reach here then we tried to use a dartUri that's not in the |
| 216 // table above. | 216 // table above. |
| 217 throw unimplemented; | 217 return null; |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 class _MockSdkLibrary implements SdkLibrary { | 222 class _MockSdkLibrary implements SdkLibrary { |
| 223 final String shortName; | 223 final String shortName; |
| 224 final String path; | 224 final String path; |
| 225 final String content; | 225 final String content; |
| 226 | 226 |
| 227 const _MockSdkLibrary(this.shortName, this.path, this.content); | 227 const _MockSdkLibrary(this.shortName, this.path, this.content); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 242 bool get isInternal => throw unimplemented; | 242 bool get isInternal => throw unimplemented; |
| 243 | 243 |
| 244 @override | 244 @override |
| 245 bool get isShared => throw unimplemented; | 245 bool get isShared => throw unimplemented; |
| 246 | 246 |
| 247 @override | 247 @override |
| 248 bool get isVmLibrary => throw unimplemented; | 248 bool get isVmLibrary => throw unimplemented; |
| 249 | 249 |
| 250 UnimplementedError get unimplemented => new UnimplementedError(); | 250 UnimplementedError get unimplemented => new UnimplementedError(); |
| 251 } | 251 } |
| OLD | NEW |