Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2991913002: Replace typed_mock with mockito in analyzer. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
11 import 'package:analyzer/error/error.dart'; 11 import 'package:analyzer/error/error.dart';
12 import 'package:analyzer/file_system/file_system.dart'; 12 import 'package:analyzer/file_system/file_system.dart';
13 import 'package:analyzer/file_system/memory_file_system.dart'; 13 import 'package:analyzer/file_system/memory_file_system.dart';
14 import 'package:analyzer/src/dart/analysis/driver.dart'; 14 import 'package:analyzer/src/dart/analysis/driver.dart';
15 import 'package:analyzer/src/dart/analysis/file_state.dart'; 15 import 'package:analyzer/src/dart/analysis/file_state.dart';
16 import 'package:analyzer/src/dart/analysis/status.dart'; 16 import 'package:analyzer/src/dart/analysis/status.dart';
17 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; 17 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
18 import 'package:analyzer/src/dart/constant/evaluation.dart'; 18 import 'package:analyzer/src/dart/constant/evaluation.dart';
19 import 'package:analyzer/src/dart/element/element.dart'; 19 import 'package:analyzer/src/dart/element/element.dart';
20 import 'package:analyzer/src/error/codes.dart'; 20 import 'package:analyzer/src/error/codes.dart';
21 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl; 21 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
22 import 'package:analyzer/src/generated/resolver.dart' show ResolverErrorCode; 22 import 'package:analyzer/src/generated/resolver.dart' show ResolverErrorCode;
23 import 'package:analyzer/src/generated/sdk.dart'; 23 import 'package:analyzer/src/generated/sdk.dart';
24 import 'package:analyzer/src/generated/source.dart'; 24 import 'package:analyzer/src/generated/source.dart';
25 import 'package:analyzer/src/summary/idl.dart'; 25 import 'package:analyzer/src/summary/idl.dart';
26 import 'package:analyzer/src/summary/package_bundle_reader.dart'; 26 import 'package:analyzer/src/summary/package_bundle_reader.dart';
27 import 'package:front_end/src/base/performace_logger.dart'; 27 import 'package:front_end/src/base/performace_logger.dart';
28 import 'package:front_end/src/incremental/byte_store.dart'; 28 import 'package:front_end/src/incremental/byte_store.dart';
29 import 'package:mockito/mockito.dart';
29 import 'package:test/test.dart'; 30 import 'package:test/test.dart';
30 import 'package:test_reflective_loader/test_reflective_loader.dart'; 31 import 'package:test_reflective_loader/test_reflective_loader.dart';
31 import 'package:typed_mock/typed_mock.dart';
32 32
33 import '../../../utils.dart'; 33 import '../../../utils.dart';
34 import '../../context/mock_sdk.dart'; 34 import '../../context/mock_sdk.dart';
35 import 'base.dart'; 35 import 'base.dart';
36 36
37 main() { 37 main() {
38 defineReflectiveSuite(() { 38 defineReflectiveSuite(() {
39 defineReflectiveTests(AnalysisDriverSchedulerTest); 39 defineReflectiveTests(AnalysisDriverSchedulerTest);
40 defineReflectiveTests(AnalysisDriverTest); 40 defineReflectiveTests(AnalysisDriverTest);
41 defineReflectiveTests(CacheAllAnalysisDriverTest); 41 defineReflectiveTests(CacheAllAnalysisDriverTest);
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 aaa() {} 1011 aaa() {}
1012 bbb() {} 1012 bbb() {}
1013 '''); 1013 ''');
1014 1014
1015 Source generatedSource = new _SourceMock(); 1015 Source generatedSource = new _SourceMock();
1016 when(generatedSource.uri).thenReturn(uri); 1016 when(generatedSource.uri).thenReturn(uri);
1017 when(generatedSource.fullName).thenReturn(generatedPath); 1017 when(generatedSource.fullName).thenReturn(generatedPath);
1018 1018
1019 when(generatedUriResolver.resolveAbsolute(uri, uri)) 1019 when(generatedUriResolver.resolveAbsolute(uri, uri))
1020 .thenReturn(generatedSource); 1020 .thenReturn(generatedSource);
1021 when(generatedUriResolver.restoreAbsolute(anyObject)) 1021 when(generatedUriResolver.restoreAbsolute(any))
1022 .thenInvoke((Source source) { 1022 .thenAnswer((Invocation invocation) {
1023 Source source = invocation.positionalArguments[0];
1023 String path = source.fullName; 1024 String path = source.fullName;
1024 if (path == templatePath || path == generatedPath) { 1025 if (path == templatePath || path == generatedPath) {
1025 return uri; 1026 return uri;
1026 } else { 1027 } else {
1027 return null; 1028 return null;
1028 } 1029 }
1029 }); 1030 });
1030 1031
1031 driver.addFile(templatePath); 1032 driver.addFile(templatePath);
1032 1033
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 test_removeFile() async { 2742 test_removeFile() async {
2742 var path = _p('/test.dart'); 2743 var path = _p('/test.dart');
2743 expect(() { 2744 expect(() {
2744 driver.removeFile(path); 2745 driver.removeFile(path);
2745 }, throwsStateError); 2746 }, throwsStateError);
2746 } 2747 }
2747 2748
2748 String _p(String path) => provider.convertPath(path); 2749 String _p(String path) => provider.convertPath(path);
2749 } 2750 }
2750 2751
2751 class _SourceMock extends TypedMock implements Source {} 2752 class _SourceMock extends Mock implements Source {}
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/dart/analysis/base.dart ('k') | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698