| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.test.generated.test.generated.source_factory; | 5 library analyzer.test.generated.test.generated.source_factory; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 11 import 'package:analyzer/source/package_map_resolver.dart'; | 11 import 'package:analyzer/source/package_map_resolver.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine, Logger; | 12 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine, Logger; |
| 13 import 'package:analyzer/src/generated/java_core.dart'; | |
| 14 import 'package:analyzer/src/generated/java_engine_io.dart'; | 13 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:analyzer/src/generated/source_io.dart'; | 15 import 'package:analyzer/src/generated/source_io.dart'; |
| 17 import 'package:analyzer/src/generated/utilities_dart.dart' as utils; | 16 import 'package:analyzer/src/generated/utilities_dart.dart' as utils; |
| 18 import 'package:analyzer/src/source/source_resource.dart'; | 17 import 'package:analyzer/src/source/source_resource.dart'; |
| 19 import 'package:package_config/packages.dart'; | 18 import 'package:package_config/packages.dart'; |
| 20 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 19 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
| 21 import 'package:package_config/src/packages_impl.dart'; | 20 import 'package:package_config/src/packages_impl.dart'; |
| 22 import 'package:path/path.dart'; | 21 import 'package:path/path.dart'; |
| 23 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 22 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 expect(result, isNotNull); | 309 expect(result, isNotNull); |
| 311 expect(result.fullName, secondPath); | 310 expect(result.fullName, secondPath); |
| 312 expect(result.uri.toString(), 'package:package/dir/second.dart'); | 311 expect(result.uri.toString(), 'package:package/dir/second.dart'); |
| 313 } | 312 } |
| 314 | 313 |
| 315 void test_restoreUri() { | 314 void test_restoreUri() { |
| 316 File file1 = resourceProvider.getFile("/some/file1.dart"); | 315 File file1 = resourceProvider.getFile("/some/file1.dart"); |
| 317 File file2 = resourceProvider.getFile("/some/file2.dart"); | 316 File file2 = resourceProvider.getFile("/some/file2.dart"); |
| 318 Source source1 = new FileSource(file1); | 317 Source source1 = new FileSource(file1); |
| 319 Source source2 = new FileSource(file2); | 318 Source source2 = new FileSource(file2); |
| 320 Uri expected1 = parseUriWithException("file:///my_file.dart"); | 319 Uri expected1 = Uri.parse("file:///my_file.dart"); |
| 321 SourceFactory factory = | 320 SourceFactory factory = |
| 322 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]); | 321 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]); |
| 323 expect(factory.restoreUri(source1), same(expected1)); | 322 expect(factory.restoreUri(source1), same(expected1)); |
| 324 expect(factory.restoreUri(source2), same(null)); | 323 expect(factory.restoreUri(source2), same(null)); |
| 325 } | 324 } |
| 326 } | 325 } |
| 327 | 326 |
| 328 class UriResolver_absolute extends UriResolver { | 327 class UriResolver_absolute extends UriResolver { |
| 329 bool invoked = false; | 328 bool invoked = false; |
| 330 | 329 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 360 UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding); | 359 UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding); |
| 361 | 360 |
| 362 @override | 361 @override |
| 363 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 362 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 364 if (uri.toString() == encoding) { | 363 if (uri.toString() == encoding) { |
| 365 return new TestSource(); | 364 return new TestSource(); |
| 366 } | 365 } |
| 367 return null; | 366 return null; |
| 368 } | 367 } |
| 369 } | 368 } |
| OLD | NEW |