| 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.html_work_manager_test; | 5 library analyzer.test.src.task.html_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/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void expect_sourceQueue(List<Source> sources) { | 318 void expect_sourceQueue(List<Source> sources) { |
| 319 expect(manager.sourceQueue, unorderedEquals(sources)); | 319 expect(manager.sourceQueue, unorderedEquals(sources)); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void setUp() { | 322 void setUp() { |
| 323 manager = new HtmlWorkManager(context); | 323 manager = new HtmlWorkManager(context); |
| 324 entry1 = context.getCacheEntry(source1); | 324 entry1 = context.getCacheEntry(source1); |
| 325 entry2 = context.getCacheEntry(source2); | 325 entry2 = context.getCacheEntry(source2); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void test_onResultInvalidated_scheduleInvalidatedLibrariesAfterSetSourceFactor
y() { | 328 void |
| 329 test_onResultInvalidated_scheduleInvalidatedLibrariesAfterSetSourceFactory
() { |
| 329 // Change the source factory, changing the analysis cache from when | 330 // Change the source factory, changing the analysis cache from when |
| 330 // the work manager was constructed. This used to create a failure | 331 // the work manager was constructed. This used to create a failure |
| 331 // case for test_onResultInvalidated_scheduleInvalidLibraries so its | 332 // case for test_onResultInvalidated_scheduleInvalidLibraries so its |
| 332 // tested here. | 333 // tested here. |
| 333 context.sourceFactory = new _SourceFactoryMock(); | 334 context.sourceFactory = new _SourceFactoryMock(); |
| 334 | 335 |
| 335 // now just do the same checks as | 336 // now just do the same checks as |
| 336 // test_onResultInvalidated_scheduleInvalidLibraries | 337 // test_onResultInvalidated_scheduleInvalidLibraries |
| 337 | 338 |
| 338 // set HTML_ERRORS for source1 and source2 | 339 // set HTML_ERRORS for source1 and source2 |
| 339 entry1.setValue(HTML_ERRORS, [], []); | 340 entry1.setValue(HTML_ERRORS, [], []); |
| 340 entry2.setValue(HTML_ERRORS, [], []); | 341 entry2.setValue(HTML_ERRORS, [], []); |
| 341 // invalidate HTML_ERRORS for source1, schedule it | 342 // invalidate HTML_ERRORS for source1, schedule it |
| 342 entry1.setState(HTML_ERRORS, CacheState.INVALID); | 343 entry1.setState(HTML_ERRORS, CacheState.INVALID); |
| 343 expect_sourceQueue([source1]); | 344 expect_sourceQueue([source1]); |
| 344 // invalidate HTML_ERRORS for source2, schedule it | 345 // invalidate HTML_ERRORS for source2, schedule it |
| 345 entry2.setState(HTML_ERRORS, CacheState.INVALID); | 346 entry2.setState(HTML_ERRORS, CacheState.INVALID); |
| 346 expect_sourceQueue([source1, source2]); | 347 expect_sourceQueue([source1, source2]); |
| 347 } | 348 } |
| 348 | |
| 349 } | 349 } |
| 350 | 350 |
| 351 class _SourceFactoryMock extends TypedMock | 351 class _SourceFactoryMock extends TypedMock implements SourceFactory {} |
| 352 implements SourceFactory { | |
| 353 } | |
| 354 | 352 |
| 355 class _InternalAnalysisContextMock extends TypedMock | 353 class _InternalAnalysisContextMock extends TypedMock |
| 356 implements InternalAnalysisContext { | 354 implements InternalAnalysisContext { |
| 357 @override | 355 @override |
| 358 CachePartition privateAnalysisCachePartition; | 356 CachePartition privateAnalysisCachePartition; |
| 359 | 357 |
| 360 @override | 358 @override |
| 361 AnalysisCache analysisCache; | 359 AnalysisCache analysisCache; |
| 362 | 360 |
| 363 // The production version is a stream that carries messages from the cache | 361 // The production version is a stream that carries messages from the cache |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 return new AnalysisErrorInfoImpl( | 393 return new AnalysisErrorInfoImpl( |
| 396 errors, getCacheEntry(source).getValue(LINE_INFO)); | 394 errors, getCacheEntry(source).getValue(LINE_INFO)); |
| 397 } | 395 } |
| 398 | 396 |
| 399 @override | 397 @override |
| 400 ChangeNoticeImpl getNotice(Source source) { | 398 ChangeNoticeImpl getNotice(Source source) { |
| 401 return _pendingNotices.putIfAbsent( | 399 return _pendingNotices.putIfAbsent( |
| 402 source, () => new ChangeNoticeImpl(source)); | 400 source, () => new ChangeNoticeImpl(source)); |
| 403 } | 401 } |
| 404 } | 402 } |
| OLD | NEW |