OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.embedder_tests; | 5 library analyzer.test.embedder_tests; |
6 | 6 |
7 import 'dart:core'; | 7 import 'dart:core'; |
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 | 11 |
12 import 'resource_utils.dart'; | 12 import 'resource_utils.dart'; |
13 | 13 |
14 abstract class EmbedderRelatedTest { | 14 abstract class EmbedderRelatedTest { |
15 final String emptyPath = '/home/.pub-cache/empty'; | 15 final String emptyPath = '/home/.pub-cache/empty'; |
16 final String foxPath = '/home/.pub-cache/fox'; | 16 final String foxPath = '/home/.pub-cache/fox'; |
17 final String foxLib = '/home/.pub-cache/fox/lib'; | 17 final String foxLib = '/home/.pub-cache/fox/lib'; |
18 | 18 |
19 TestPathTranslator pathTranslator; | 19 TestPathTranslator pathTranslator; |
20 ResourceProvider resourceProvider; | 20 ResourceProvider resourceProvider; |
21 | 21 |
22 buildResourceProvider() { | 22 buildResourceProvider() { |
23 MemoryResourceProvider rawProvider = new MemoryResourceProvider(); | 23 MemoryResourceProvider rawProvider = new MemoryResourceProvider(); |
24 resourceProvider = new TestResourceProvider(rawProvider); | 24 resourceProvider = new TestResourceProvider(rawProvider); |
25 pathTranslator = new TestPathTranslator(rawProvider) | 25 pathTranslator = new TestPathTranslator(rawProvider) |
26 ..newFolder('/home/.pub-cache/empty') | 26 ..newFolder('/home/.pub-cache/empty') |
27 ..newFolder('/home/.pub-cache/fox/lib') | 27 ..newFolder('/home/.pub-cache/fox/lib') |
28 ..newFile( | 28 ..newFile('/home/.pub-cache/fox/lib/_embedder.yaml', r''' |
29 '/home/.pub-cache/fox/lib/_embedder.yaml', | |
30 r''' | |
31 embedded_libs: | 29 embedded_libs: |
32 "dart:core" : "core.dart" | 30 "dart:core" : "core.dart" |
33 "dart:fox": "slippy.dart" | 31 "dart:fox": "slippy.dart" |
34 "dart:bear": "grizzly.dart" | 32 "dart:bear": "grizzly.dart" |
35 "dart:relative": "../relative.dart" | 33 "dart:relative": "../relative.dart" |
36 "dart:deep": "deep/directory/file.dart" | 34 "dart:deep": "deep/directory/file.dart" |
37 "fart:loudly": "nomatter.dart" | 35 "fart:loudly": "nomatter.dart" |
38 '''); | 36 '''); |
39 } | 37 } |
40 | 38 |
41 clearResourceProvider() { | 39 clearResourceProvider() { |
42 resourceProvider = null; | 40 resourceProvider = null; |
43 pathTranslator = null; | 41 pathTranslator = null; |
44 } | 42 } |
45 | 43 |
46 void setUp() { | 44 void setUp() { |
47 buildResourceProvider(); | 45 buildResourceProvider(); |
48 } | 46 } |
49 | 47 |
50 void tearDown() { | 48 void tearDown() { |
51 clearResourceProvider(); | 49 clearResourceProvider(); |
52 } | 50 } |
53 } | 51 } |
OLD | NEW |