| 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.driver_test; | 5 library analyzer.test.src.task.driver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/exception/exception.dart'; | 7 import 'package:analyzer/exception/exception.dart'; |
| 8 import 'package:analyzer/src/context/cache.dart'; | 8 import 'package:analyzer/src/context/cache.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/task/driver.dart'; | 10 import 'package:analyzer/src/task/driver.dart'; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 taskManager.addTaskDescriptor(descriptor); | 180 taskManager.addTaskDescriptor(descriptor); |
| 181 context.getCacheEntry(target).setState(result, CacheState.INVALID); | 181 context.getCacheEntry(target).setState(result, CacheState.INVALID); |
| 182 | 182 |
| 183 WorkOrder workOrder = | 183 WorkOrder workOrder = |
| 184 analysisDriver.createWorkOrderForResult(target, result); | 184 analysisDriver.createWorkOrderForResult(target, result); |
| 185 expect(workOrder, isNotNull); | 185 expect(workOrder, isNotNull); |
| 186 } | 186 } |
| 187 | 187 |
| 188 test_createWorkOrderForResult_valid() { | 188 test_createWorkOrderForResult_valid() { |
| 189 AnalysisTarget target = new TestSource(); | 189 AnalysisTarget target = new TestSource(); |
| 190 ResultDescriptor result = new ResultDescriptor('result', null); | 190 ResultDescriptor<String> result = |
| 191 new ResultDescriptor<String>('result', null); |
| 191 context | 192 context |
| 192 .getCacheEntry(target) | 193 .getCacheEntry(target) |
| 193 .setValue(result, '', TargetedResult.EMPTY_LIST); | 194 .setValue(result, '', TargetedResult.EMPTY_LIST); |
| 194 | 195 |
| 195 expect(analysisDriver.createWorkOrderForResult(target, result), isNull); | 196 expect(analysisDriver.createWorkOrderForResult(target, result), isNull); |
| 196 } | 197 } |
| 197 | 198 |
| 198 test_createWorkOrderForTarget_complete_generalTarget_generalResult() { | 199 test_createWorkOrderForTarget_complete_generalTarget_generalResult() { |
| 199 _createWorkOrderForTarget(true, false, false); | 200 _createWorkOrderForTarget(true, false, false); |
| 200 } | 201 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 /** | 473 /** |
| 473 * [complete] is `true` if the value of the result has already been computed. | 474 * [complete] is `true` if the value of the result has already been computed. |
| 474 * [priorityTarget] is `true` if the target is in the list of priority | 475 * [priorityTarget] is `true` if the target is in the list of priority |
| 475 * targets. | 476 * targets. |
| 476 * [priorityResult] is `true` if the result should only be computed for | 477 * [priorityResult] is `true` if the result should only be computed for |
| 477 * priority targets. | 478 * priority targets. |
| 478 */ | 479 */ |
| 479 _createWorkOrderForTarget( | 480 _createWorkOrderForTarget( |
| 480 bool complete, bool priorityTarget, bool priorityResult) { | 481 bool complete, bool priorityTarget, bool priorityResult) { |
| 481 AnalysisTarget target = new TestSource(); | 482 AnalysisTarget target = new TestSource(); |
| 482 ResultDescriptor result = new ResultDescriptor('result', null); | 483 ResultDescriptor<String> result = |
| 484 new ResultDescriptor<String>('result', null); |
| 483 TaskDescriptor descriptor = new TaskDescriptor( | 485 TaskDescriptor descriptor = new TaskDescriptor( |
| 484 'task', | 486 'task', |
| 485 (context, target) => new TestAnalysisTask(context, target), | 487 (context, target) => new TestAnalysisTask(context, target), |
| 486 (target) => {}, | 488 (target) => {}, |
| 487 [result]); | 489 [result]); |
| 488 if (priorityResult) { | 490 if (priorityResult) { |
| 489 taskManager.addPriorityResult(result); | 491 taskManager.addPriorityResult(result); |
| 490 } else { | 492 } else { |
| 491 taskManager.addGeneralResult(result); | 493 taskManager.addGeneralResult(result); |
| 492 } | 494 } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 if (!skipInputs.contains(dependency) && | 861 if (!skipInputs.contains(dependency) && |
| 860 !evaluatedNodes.contains(dependency)) { | 862 !evaluatedNodes.contains(dependency)) { |
| 861 return dependency; | 863 return dependency; |
| 862 } | 864 } |
| 863 } | 865 } |
| 864 return null; | 866 return null; |
| 865 } | 867 } |
| 866 } | 868 } |
| 867 | 869 |
| 868 class _WorkManagerMock extends TypedMock implements WorkManager {} | 870 class _WorkManagerMock extends TypedMock implements WorkManager {} |
| OLD | NEW |