Chromium Code Reviews| Index: test/testing.dart |
| diff --git a/test/testing.dart b/test/testing.dart |
| index 353ca3f1035eeef0b49df597674c5c10cf80d0aa..5c66f96a5d4b524a21d6918db0ccb1f493e5cebb 100644 |
| --- a/test/testing.dart |
| +++ b/test/testing.dart |
| @@ -11,6 +11,7 @@ import 'package:analyzer/src/generated/ast.dart'; |
| import 'package:analyzer/src/generated/engine.dart' |
| show AnalysisContext, AnalysisEngine, AnalysisOptionsImpl; |
| import 'package:analyzer/src/generated/error.dart'; |
| +import 'package:analyzer/src/generated/source.dart'; |
| import 'package:cli_util/cli_util.dart' show getSdkDir; |
| import 'package:logging/logging.dart'; |
| import 'package:path/path.dart' as path; |
| @@ -28,8 +29,18 @@ import 'package:dev_compiler/src/utils.dart'; |
| /// Shared analysis context used for compilation. |
| final realSdkContext = createAnalysisContextWithSources(new StrongModeOptions(), |
| - new SourceResolverOptions(dartSdkPath: getSdkDir().path)) |
| - ..analysisOptions = (new AnalysisOptionsImpl()..cacheSize = 512); |
| + new SourceResolverOptions( |
| + dartSdkPath: getSdkDir().path, |
| + customUrlMappings: { |
| + 'package:expect/expect.dart': _testCodegenPath('expect.dart'), |
| + 'package:async_helper/async_helper.dart': |
| + _testCodegenPath('async_helper.dart'), |
| + 'package:unittest/unittest.dart': _testCodegenPath('unittest.dart'), |
| + 'package:dom/dom.dart': _testCodegenPath('sunflower', 'dom.dart') |
|
vsm
2015/07/27 21:03:24
Move out of sunflower? And perhaps all of these i
Jennifer Messerly
2015/07/27 21:46:35
Good ideas, filed https://github.com/dart-lang/dev
|
| +}))..analysisOptions = (new AnalysisOptionsImpl()..cacheSize = 512); |
| + |
| +String _testCodegenPath(String p1, [String p2]) => |
| + path.join(testDirectory, 'codegen', p1, p2); |
| final String testDirectory = |
| path.dirname((reflectClass(_TestUtils).owner as LibraryMirror).uri.path); |
| @@ -125,12 +136,14 @@ class TestUriResolver extends ResourceUriResolver { |
| TestUriResolver(provider) |
| : provider = provider, |
| super(provider); |
| - resolveAbsolute(Uri uri) { |
| + |
| + @override |
| + Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| if (uri.scheme == 'package') { |
| return (provider.getResource('/packages/' + uri.path) as File) |
| .createSource(uri); |
| } |
| - return super.resolveAbsolute(uri); |
| + return super.resolveAbsolute(uri, actualUri); |
| } |
| } |