| OLD | NEW |
| 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 library analyzer.test.driver; | 5 library analyzer.test.driver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // Remove a file. | 376 // Remove a file. |
| 377 // The cache is flushed. | 377 // The cache is flushed. |
| 378 driver.removeFile(b); | 378 driver.removeFile(b); |
| 379 expect(driver.test.priorityResults, isEmpty); | 379 expect(driver.test.priorityResults, isEmpty); |
| 380 } | 380 } |
| 381 | 381 |
| 382 test_cachedPriorityResults_flush_onPrioritySetChange() async { | 382 test_cachedPriorityResults_flush_onPrioritySetChange() async { |
| 383 var a = _p('/test/bin/a.dart'); | 383 var a = _p('/test/bin/a.dart'); |
| 384 var b = _p('/test/bin/b.dart'); | 384 var b = _p('/test/bin/b.dart'); |
| 385 provider.newFile(a, 'var a = 1;'); | 385 provider.newFile(a, 'var a = 1;'); |
| 386 provider.newFile(a, 'var b = 2;'); | 386 provider.newFile(b, 'var b = 2;'); |
| 387 | 387 |
| 388 driver.priorityFiles = [a]; | 388 driver.priorityFiles = [a]; |
| 389 | 389 |
| 390 AnalysisResult result1 = await driver.getResult(a); | 390 AnalysisResult result1 = await driver.getResult(a); |
| 391 expect(driver.test.priorityResults, hasLength(1)); | 391 expect(driver.test.priorityResults, hasLength(1)); |
| 392 expect(driver.test.priorityResults, containsPair(a, result1)); | 392 expect(driver.test.priorityResults, containsPair(a, result1)); |
| 393 | 393 |
| 394 // Make "a" and "b" priority. | 394 // Make "a" and "b" priority. |
| 395 // We still have the result for "a" cached. | 395 // We still have the result for "a" cached. |
| 396 driver.priorityFiles = [a, b]; | 396 driver.priorityFiles = [a, b]; |
| (...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2065 * Return the [provider] specific path for the given Posix [path]. | 2065 * Return the [provider] specific path for the given Posix [path]. |
| 2066 */ | 2066 */ |
| 2067 String _p(String path) => provider.convertPath(path); | 2067 String _p(String path) => provider.convertPath(path); |
| 2068 | 2068 |
| 2069 static String _md5(String content) { | 2069 static String _md5(String content) { |
| 2070 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2070 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2071 } | 2071 } |
| 2072 } | 2072 } |
| 2073 | 2073 |
| 2074 class _SourceMock extends TypedMock implements Source {} | 2074 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |