OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 5 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
6 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
8 | 8 |
9 import '../integration_tests.dart'; | 9 import '../integration_tests.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 defineReflectiveSuite(() { | 12 defineReflectiveSuite(() { |
13 defineReflectiveTests(MapUriTest); | 13 defineReflectiveTests(MapUriTest); |
14 defineReflectiveTests(MapUriTest_Driver); | |
15 }); | 14 }); |
16 } | 15 } |
17 | 16 |
18 abstract class AbstractMapUriTest | 17 @reflectiveTest |
19 extends AbstractAnalysisServerIntegrationTest { | 18 class MapUriTest extends AbstractAnalysisServerIntegrationTest { |
20 test_mapUri() async { | 19 test_mapUri() async { |
21 String pathname = sourcePath('lib/main.dart'); | 20 String pathname = sourcePath('lib/main.dart'); |
22 writeFile(pathname, '// dummy'); | 21 writeFile(pathname, '// dummy'); |
23 writeFile(sourcePath('.packages'), 'foo:lib/'); | 22 writeFile(sourcePath('.packages'), 'foo:lib/'); |
24 standardAnalysisSetup(); | 23 standardAnalysisSetup(); |
25 | 24 |
26 String contextId = | 25 String contextId = |
27 (await sendExecutionCreateContext(sourceDirectory.path))?.id; | 26 (await sendExecutionCreateContext(sourceDirectory.path))?.id; |
28 | 27 |
29 { | 28 { |
30 ExecutionMapUriResult result = | 29 ExecutionMapUriResult result = |
31 await sendExecutionMapUri(contextId, uri: 'package:foo/main.dart'); | 30 await sendExecutionMapUri(contextId, uri: 'package:foo/main.dart'); |
32 expect(result.file, pathname); | 31 expect(result.file, pathname); |
33 } | 32 } |
34 | 33 |
35 { | 34 { |
36 ExecutionMapUriResult result = | 35 ExecutionMapUriResult result = |
37 await sendExecutionMapUri(contextId, file: pathname); | 36 await sendExecutionMapUri(contextId, file: pathname); |
38 expect(result.uri, 'package:foo/main.dart'); | 37 expect(result.uri, 'package:foo/main.dart'); |
39 } | 38 } |
40 } | 39 } |
41 } | 40 } |
42 | |
43 @reflectiveTest | |
44 class MapUriTest extends AbstractMapUriTest {} | |
45 | |
46 @reflectiveTest | |
47 class MapUriTest_Driver extends AbstractMapUriTest { | |
48 @override | |
49 bool get enableNewAnalysisDriver => true; | |
50 } | |
OLD | NEW |