| 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.src.task.options_work_manager_test; | 5 library analyzer.test.src.task.options_work_manager_test; |
| 6 | 6 |
| 7 import 'package:analyzer/error/error.dart' show AnalysisError; | 7 import 'package:analyzer/error/error.dart' show AnalysisError; |
| 8 import 'package:analyzer/exception/exception.dart'; | 8 import 'package:analyzer/exception/exception.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/error/codes.dart' show AnalysisOptionsErrorCode; | 10 import 'package:analyzer/src/error/codes.dart' show AnalysisOptionsErrorCode; |
| 11 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
| 12 show | 12 show |
| 13 AnalysisEngine, | 13 AnalysisEngine, |
| 14 AnalysisErrorInfo, | 14 AnalysisErrorInfo, |
| 15 AnalysisErrorInfoImpl, | 15 AnalysisErrorInfoImpl, |
| 16 CacheState, | 16 CacheState, |
| 17 ChangeNoticeImpl, | 17 ChangeNoticeImpl, |
| 18 InternalAnalysisContext; | 18 InternalAnalysisContext; |
| 19 import 'package:analyzer/src/generated/source.dart'; | 19 import 'package:analyzer/src/generated/source.dart'; |
| 20 import 'package:analyzer/src/task/options.dart'; | 20 import 'package:analyzer/src/task/options.dart'; |
| 21 import 'package:analyzer/src/task/options_work_manager.dart'; | 21 import 'package:analyzer/src/task/options_work_manager.dart'; |
| 22 import 'package:analyzer/task/dart.dart'; | 22 import 'package:analyzer/task/dart.dart'; |
| 23 import 'package:analyzer/task/general.dart'; | 23 import 'package:analyzer/task/general.dart'; |
| 24 import 'package:analyzer/task/model.dart'; | 24 import 'package:analyzer/task/model.dart'; |
| 25 import 'package:mockito/mockito.dart'; |
| 25 import 'package:test/test.dart'; | 26 import 'package:test/test.dart'; |
| 26 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 27 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 27 import 'package:typed_mock/typed_mock.dart'; | |
| 28 | 28 |
| 29 import '../../generated/test_support.dart'; | 29 import '../../generated/test_support.dart'; |
| 30 | 30 |
| 31 main() { | 31 main() { |
| 32 defineReflectiveSuite(() { | 32 defineReflectiveSuite(() { |
| 33 defineReflectiveTests(OptionsWorkManagerNewFileTest); | 33 defineReflectiveTests(OptionsWorkManagerNewFileTest); |
| 34 defineReflectiveTests(OptionsWorkManagerOldFileTest); | 34 defineReflectiveTests(OptionsWorkManagerOldFileTest); |
| 35 }); | 35 }); |
| 36 } | 36 } |
| 37 | 37 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 .setValue(ANALYSIS_OPTIONS_ERRORS, <AnalysisError>[error1, error2], []); | 251 .setValue(ANALYSIS_OPTIONS_ERRORS, <AnalysisError>[error1, error2], []); |
| 252 // RESOLVED_UNIT is ready, set errors | 252 // RESOLVED_UNIT is ready, set errors |
| 253 manager.resultsComputed(source1, {ANALYSIS_OPTIONS_ERRORS: null}); | 253 manager.resultsComputed(source1, {ANALYSIS_OPTIONS_ERRORS: null}); |
| 254 // all of the errors are included | 254 // all of the errors are included |
| 255 ChangeNoticeImpl notice = context.getNotice(source1); | 255 ChangeNoticeImpl notice = context.getNotice(source1); |
| 256 expect(notice.errors, unorderedEquals([error1, error2])); | 256 expect(notice.errors, unorderedEquals([error1, error2])); |
| 257 expect(notice.lineInfo, lineInfo); | 257 expect(notice.lineInfo, lineInfo); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 class _InternalAnalysisContextMock extends TypedMock | 261 class _InternalAnalysisContextMock extends Mock |
| 262 implements InternalAnalysisContext { | 262 implements InternalAnalysisContext { |
| 263 @override | 263 @override |
| 264 CachePartition privateAnalysisCachePartition; | 264 CachePartition privateAnalysisCachePartition; |
| 265 | 265 |
| 266 @override | 266 @override |
| 267 AnalysisCache analysisCache; | 267 AnalysisCache analysisCache; |
| 268 | 268 |
| 269 Map<Source, ChangeNoticeImpl> _pendingNotices = <Source, ChangeNoticeImpl>{}; | 269 Map<Source, ChangeNoticeImpl> _pendingNotices = <Source, ChangeNoticeImpl>{}; |
| 270 | 270 |
| 271 _InternalAnalysisContextMock() { | 271 _InternalAnalysisContextMock() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 290 errors = getCacheEntry(source).getValue(ANALYSIS_OPTIONS_ERRORS); | 290 errors = getCacheEntry(source).getValue(ANALYSIS_OPTIONS_ERRORS); |
| 291 } | 291 } |
| 292 return new AnalysisErrorInfoImpl( | 292 return new AnalysisErrorInfoImpl( |
| 293 errors, getCacheEntry(source).getValue(LINE_INFO)); | 293 errors, getCacheEntry(source).getValue(LINE_INFO)); |
| 294 } | 294 } |
| 295 | 295 |
| 296 @override | 296 @override |
| 297 ChangeNoticeImpl getNotice(Source source) => | 297 ChangeNoticeImpl getNotice(Source source) => |
| 298 _pendingNotices.putIfAbsent(source, () => new ChangeNoticeImpl(source)); | 298 _pendingNotices.putIfAbsent(source, () => new ChangeNoticeImpl(source)); |
| 299 } | 299 } |
| OLD | NEW |