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

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

Issue 2517263002: Extract BaseAnalysisDriverTest. (Closed)
Patch Set: Created 4 years, 1 month 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 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';
11 import 'package:analyzer/dart/element/element.dart'; 11 import 'package:analyzer/dart/element/element.dart';
12 import 'package:analyzer/error/error.dart'; 12 import 'package:analyzer/error/error.dart';
13 import 'package:analyzer/file_system/file_system.dart'; 13 import 'package:analyzer/file_system/file_system.dart';
14 import 'package:analyzer/file_system/memory_file_system.dart'; 14 import 'package:analyzer/file_system/memory_file_system.dart';
15 import 'package:analyzer/source/package_map_resolver.dart';
16 import 'package:analyzer/src/dart/analysis/byte_store.dart'; 15 import 'package:analyzer/src/dart/analysis/byte_store.dart';
17 import 'package:analyzer/src/dart/analysis/driver.dart'; 16 import 'package:analyzer/src/dart/analysis/driver.dart';
18 import 'package:analyzer/src/dart/analysis/file_state.dart'; 17 import 'package:analyzer/src/dart/analysis/file_state.dart';
19 import 'package:analyzer/src/dart/analysis/status.dart'; 18 import 'package:analyzer/src/dart/analysis/status.dart';
20 import 'package:analyzer/src/error/codes.dart'; 19 import 'package:analyzer/src/error/codes.dart';
21 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl; 20 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
22 import 'package:analyzer/src/generated/source.dart'; 21 import 'package:analyzer/src/generated/source.dart';
23 import 'package:convert/convert.dart'; 22 import 'package:convert/convert.dart';
24 import 'package:crypto/crypto.dart'; 23 import 'package:crypto/crypto.dart';
25 import 'package:test/test.dart'; 24 import 'package:test/test.dart';
26 import 'package:test_reflective_loader/test_reflective_loader.dart'; 25 import 'package:test_reflective_loader/test_reflective_loader.dart';
27 26
28 import '../../context/mock_sdk.dart'; 27 import '../../context/mock_sdk.dart';
28 import 'base.dart';
29 29
30 main() { 30 main() {
31 defineReflectiveSuite(() { 31 defineReflectiveSuite(() {
32 defineReflectiveTests(AnalysisDriverTest); 32 defineReflectiveTests(AnalysisDriverTest);
33 defineReflectiveTests(AnalysisDriverSchedulerTest); 33 defineReflectiveTests(AnalysisDriverSchedulerTest);
34 }); 34 });
35 } 35 }
36 36
37 /** 37 /**
38 * Returns a [Future] that completes after pumping the event queue [times] 38 * Returns a [Future] that completes after pumping the event queue [times]
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 expect(allStatuses[0].isAnalyzing, isTrue); 209 expect(allStatuses[0].isAnalyzing, isTrue);
210 expect(allStatuses[1].isAnalyzing, isFalse); 210 expect(allStatuses[1].isAnalyzing, isFalse);
211 211
212 expect(allResults, hasLength(3)); 212 expect(allResults, hasLength(3));
213 } 213 }
214 214
215 String _p(String path) => provider.convertPath(path); 215 String _p(String path) => provider.convertPath(path);
216 } 216 }
217 217
218 @reflectiveTest 218 @reflectiveTest
219 class AnalysisDriverTest { 219 class AnalysisDriverTest extends BaseAnalysisDriverTest {
220 static final MockSdk sdk = new MockSdk();
221
222 final MemoryResourceProvider provider = new MemoryResourceProvider();
223 final ByteStore byteStore = new MemoryByteStore();
224 final FileContentOverlay contentOverlay = new FileContentOverlay();
225
226 final StringBuffer logBuffer = new StringBuffer();
227 PerformanceLog logger;
228
229 AnalysisDriverScheduler scheduler;
230 AnalysisDriver driver;
231 final _Monitor idleStatusMonitor = new _Monitor();
232 final List<AnalysisStatus> allStatuses = <AnalysisStatus>[];
233 final List<AnalysisResult> allResults = <AnalysisResult>[];
234
235 String testProject;
236 String testFile;
237
238 void setUp() {
239 new MockSdk();
240 testProject = _p('/test/lib');
241 testFile = _p('/test/lib/test.dart');
242 logger = new PerformanceLog(logBuffer);
243 scheduler = new AnalysisDriverScheduler(logger);
244 driver = new AnalysisDriver(
245 scheduler,
246 logger,
247 provider,
248 byteStore,
249 contentOverlay,
250 new SourceFactory([
251 new DartUriResolver(sdk),
252 new PackageMapUriResolver(provider, <String, List<Folder>>{
253 'test': [provider.getFolder(testProject)]
254 }),
255 new ResourceUriResolver(provider)
256 ], null, provider),
257 new AnalysisOptionsImpl()..strongMode = true);
258 scheduler.start();
259 driver.status.lastWhere((status) {
260 allStatuses.add(status);
261 if (status.isIdle) {
262 idleStatusMonitor.notify();
263 }
264 });
265 driver.results.listen(allResults.add);
266 }
267
268 test_addedFiles() async { 220 test_addedFiles() async {
269 var a = _p('/test/lib/a.dart'); 221 var a = _p('/test/lib/a.dart');
270 var b = _p('/test/lib/b.dart'); 222 var b = _p('/test/lib/b.dart');
271 223
272 driver.addFile(a); 224 driver.addFile(a);
273 expect(driver.addedFiles, contains(a)); 225 expect(driver.addedFiles, contains(a));
274 expect(driver.addedFiles, isNot(contains(b))); 226 expect(driver.addedFiles, isNot(contains(b)));
275 227
276 driver.removeFile(a); 228 driver.removeFile(a);
277 expect(driver.addedFiles, isNot(contains(a))); 229 expect(driver.addedFiles, isNot(contains(a)));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 expect(_getTopLevelVarType(ar.unit, 'A1'), 'double'); 339 expect(_getTopLevelVarType(ar.unit, 'A1'), 'double');
388 expect(_getTopLevelVarType(ar.unit, 'A2'), 'double'); 340 expect(_getTopLevelVarType(ar.unit, 'A2'), 'double');
389 } 341 }
390 { 342 {
391 AnalysisResult br = allResults.firstWhere((r) => r.path == b); 343 AnalysisResult br = allResults.firstWhere((r) => r.path == b);
392 expect(_getTopLevelVarType(br.unit, 'B1'), 'double'); 344 expect(_getTopLevelVarType(br.unit, 'B1'), 'double');
393 } 345 }
394 } 346 }
395 347
396 test_changeFile_single() async { 348 test_changeFile_single() async {
397 _addTestFile('var V = 1;', priority: true); 349 addTestFile('var V = 1;', priority: true);
398 350
399 // Initial analysis. 351 // Initial analysis.
400 { 352 {
401 await _waitForIdle(); 353 await _waitForIdle();
402 expect(allResults, hasLength(1)); 354 expect(allResults, hasLength(1));
403 AnalysisResult result = allResults[0]; 355 AnalysisResult result = allResults[0];
404 expect(result.path, testFile); 356 expect(result.path, testFile);
405 expect(_getTopLevelVarType(result.unit, 'V'), 'int'); 357 expect(_getTopLevelVarType(result.unit, 'V'), 'int');
406 } 358 }
407 359
(...skipping 13 matching lines...) Expand all
421 await _waitForIdle(); 373 await _waitForIdle();
422 expect(allResults, hasLength(1)); 374 expect(allResults, hasLength(1));
423 AnalysisResult result = allResults[0]; 375 AnalysisResult result = allResults[0];
424 expect(result.path, testFile); 376 expect(result.path, testFile);
425 expect(_getTopLevelVarType(result.unit, 'V'), 'double'); 377 expect(_getTopLevelVarType(result.unit, 'V'), 'double');
426 } 378 }
427 } 379 }
428 380
429 test_getResult() async { 381 test_getResult() async {
430 String content = 'int f() => 42;'; 382 String content = 'int f() => 42;';
431 _addTestFile(content, priority: true); 383 addTestFile(content, priority: true);
432 384
433 AnalysisResult result = await driver.getResult(testFile); 385 AnalysisResult result = await driver.getResult(testFile);
434 expect(result.path, testFile); 386 expect(result.path, testFile);
435 expect(result.uri.toString(), 'package:test/test.dart'); 387 expect(result.uri.toString(), 'package:test/test.dart');
436 expect(result.content, content); 388 expect(result.content, content);
437 expect(result.contentHash, _md5(content)); 389 expect(result.contentHash, _md5(content));
438 expect(result.unit, isNotNull); 390 expect(result.unit, isNotNull);
439 expect(result.errors, hasLength(0)); 391 expect(result.errors, hasLength(0));
440 392
441 var f = result.unit.declarations[0] as FunctionDeclaration; 393 var f = result.unit.declarations[0] as FunctionDeclaration;
(...skipping 21 matching lines...) Expand all
463 driver.addFile(a); 415 driver.addFile(a);
464 driver.addFile(b); 416 driver.addFile(b);
465 await _waitForIdle(); 417 await _waitForIdle();
466 418
467 AnalysisResult result = await driver.getResult(b); 419 AnalysisResult result = await driver.getResult(b);
468 expect(result.errors, isEmpty); 420 expect(result.errors, isEmpty);
469 } 421 }
470 422
471 test_getResult_errors() async { 423 test_getResult_errors() async {
472 String content = 'main() { int vv; }'; 424 String content = 'main() { int vv; }';
473 _addTestFile(content, priority: true); 425 addTestFile(content, priority: true);
474 426
475 AnalysisResult result = await driver.getResult(testFile); 427 AnalysisResult result = await driver.getResult(testFile);
476 expect(result.path, testFile); 428 expect(result.path, testFile);
477 expect(result.errors, hasLength(1)); 429 expect(result.errors, hasLength(1));
478 { 430 {
479 AnalysisError error = result.errors[0]; 431 AnalysisError error = result.errors[0];
480 expect(error.offset, 13); 432 expect(error.offset, 13);
481 expect(error.length, 2); 433 expect(error.length, 2);
482 expect(error.errorCode, HintCode.UNUSED_LOCAL_VARIABLE); 434 expect(error.errorCode, HintCode.UNUSED_LOCAL_VARIABLE);
483 expect(error.message, "The value of the local variable 'vv' isn't used."); 435 expect(error.message, "The value of the local variable 'vv' isn't used.");
484 expect(error.correction, "Try removing the variable, or using it."); 436 expect(error.correction, "Try removing the variable, or using it.");
485 } 437 }
486 } 438 }
487 439
488 test_getResult_inferTypes_finalField() async { 440 test_getResult_inferTypes_finalField() async {
489 _addTestFile( 441 addTestFile(
490 r''' 442 r'''
491 class C { 443 class C {
492 final f = 42; 444 final f = 42;
493 } 445 }
494 ''', 446 ''',
495 priority: true); 447 priority: true);
496 await _waitForIdle(); 448 await _waitForIdle();
497 449
498 AnalysisResult result = await driver.getResult(testFile); 450 AnalysisResult result = await driver.getResult(testFile);
499 expect(_getClassFieldType(result.unit, 'C', 'f'), 'int'); 451 expect(_getClassFieldType(result.unit, 'C', 'f'), 'int');
500 } 452 }
501 453
502 test_getResult_inferTypes_instanceMethod() async { 454 test_getResult_inferTypes_instanceMethod() async {
503 _addTestFile( 455 addTestFile(
504 r''' 456 r'''
505 class A { 457 class A {
506 int m(double p) => 1; 458 int m(double p) => 1;
507 } 459 }
508 class B extends A { 460 class B extends A {
509 m(double p) => 2; 461 m(double p) => 2;
510 } 462 }
511 ''', 463 ''',
512 priority: true); 464 priority: true);
513 await _waitForIdle(); 465 await _waitForIdle();
514 466
515 AnalysisResult result = await driver.getResult(testFile); 467 AnalysisResult result = await driver.getResult(testFile);
516 expect(_getClassMethodReturnType(result.unit, 'A', 'm'), 'int'); 468 expect(_getClassMethodReturnType(result.unit, 'A', 'm'), 'int');
517 expect(_getClassMethodReturnType(result.unit, 'B', 'm'), 'int'); 469 expect(_getClassMethodReturnType(result.unit, 'B', 'm'), 'int');
518 } 470 }
519 471
520 test_getResult_invalidUri_exports_dart() async { 472 test_getResult_invalidUri_exports_dart() async {
521 String content = r''' 473 String content = r'''
522 export 'dart:async'; 474 export 'dart:async';
523 export 'dart:noSuchLib'; 475 export 'dart:noSuchLib';
524 export 'dart:math'; 476 export 'dart:math';
525 '''; 477 ''';
526 _addTestFile(content, priority: true); 478 addTestFile(content, priority: true);
527 479
528 AnalysisResult result = await driver.getResult(testFile); 480 AnalysisResult result = await driver.getResult(testFile);
529 expect(result.path, testFile); 481 expect(result.path, testFile);
530 // Has only exports for valid URIs. 482 // Has only exports for valid URIs.
531 List<ExportElement> imports = result.unit.element.library.exports; 483 List<ExportElement> imports = result.unit.element.library.exports;
532 expect( 484 expect(
533 imports.map((import) => import.exportedLibrary.source.uri.toString()), 485 imports.map((import) => import.exportedLibrary.source.uri.toString()),
534 unorderedEquals(['dart:async', 'dart:math'])); 486 unorderedEquals(['dart:async', 'dart:math']));
535 } 487 }
536 488
537 test_getResult_invalidUri_imports_dart() async { 489 test_getResult_invalidUri_imports_dart() async {
538 String content = r''' 490 String content = r'''
539 import 'dart:async'; 491 import 'dart:async';
540 import 'dart:noSuchLib'; 492 import 'dart:noSuchLib';
541 import 'dart:math'; 493 import 'dart:math';
542 '''; 494 ''';
543 _addTestFile(content, priority: true); 495 addTestFile(content, priority: true);
544 496
545 AnalysisResult result = await driver.getResult(testFile); 497 AnalysisResult result = await driver.getResult(testFile);
546 expect(result.path, testFile); 498 expect(result.path, testFile);
547 // Has only imports for valid URIs. 499 // Has only imports for valid URIs.
548 List<ImportElement> imports = result.unit.element.library.imports; 500 List<ImportElement> imports = result.unit.element.library.imports;
549 expect( 501 expect(
550 imports.map((import) => import.importedLibrary.source.uri.toString()), 502 imports.map((import) => import.importedLibrary.source.uri.toString()),
551 unorderedEquals(['dart:async', 'dart:math', 'dart:core'])); 503 unorderedEquals(['dart:async', 'dart:math', 'dart:core']));
552 } 504 }
553 505
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 var A2 = B1; 644 var A2 = B1;
693 '''); 645 ''');
694 { 646 {
695 AnalysisResult result = await driver.getResult(a); 647 AnalysisResult result = await driver.getResult(a);
696 expect(_getTopLevelVarType(result.unit, 'A1'), 'double'); 648 expect(_getTopLevelVarType(result.unit, 'A1'), 'double');
697 expect(_getTopLevelVarType(result.unit, 'A2'), 'double'); 649 expect(_getTopLevelVarType(result.unit, 'A2'), 'double');
698 } 650 }
699 } 651 }
700 652
701 test_getResult_thenRemove() async { 653 test_getResult_thenRemove() async {
702 _addTestFile('main() {}', priority: true); 654 addTestFile('main() {}', priority: true);
703 655
704 Future<AnalysisResult> resultFuture = driver.getResult(testFile); 656 Future<AnalysisResult> resultFuture = driver.getResult(testFile);
705 driver.removeFile(testFile); 657 driver.removeFile(testFile);
706 658
707 AnalysisResult result = await resultFuture; 659 AnalysisResult result = await resultFuture;
708 expect(result, isNotNull); 660 expect(result, isNotNull);
709 expect(result.path, testFile); 661 expect(result.path, testFile);
710 expect(result.unit, isNotNull); 662 expect(result.unit, isNotNull);
711 } 663 }
712 664
713 test_getResult_twoPendingFutures() async { 665 test_getResult_twoPendingFutures() async {
714 String content = 'main() {}'; 666 String content = 'main() {}';
715 _addTestFile(content, priority: true); 667 addTestFile(content, priority: true);
716 668
717 Future<AnalysisResult> future1 = driver.getResult(testFile); 669 Future<AnalysisResult> future1 = driver.getResult(testFile);
718 Future<AnalysisResult> future2 = driver.getResult(testFile); 670 Future<AnalysisResult> future2 = driver.getResult(testFile);
719 671
720 // Both futures complete, with the same result. 672 // Both futures complete, with the same result.
721 AnalysisResult result1 = await future1; 673 AnalysisResult result1 = await future1;
722 AnalysisResult result2 = await future2; 674 AnalysisResult result2 = await future2;
723 expect(result2, same(result1)); 675 expect(result2, same(result1));
724 expect(result1.path, testFile); 676 expect(result1.path, testFile);
725 expect(result1.unit, isNotNull); 677 expect(result1.unit, isNotNull);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // But the change causes "a" to be reanalyzed. 989 // But the change causes "a" to be reanalyzed.
1038 await _waitForIdle(); 990 await _waitForIdle();
1039 expect(allResults, hasLength(1)); 991 expect(allResults, hasLength(1));
1040 { 992 {
1041 AnalysisResult ar = allResults.firstWhere((r) => r.path == a); 993 AnalysisResult ar = allResults.firstWhere((r) => r.path == a);
1042 expect(_getTopLevelVarType(ar.unit, 'A'), 'double'); 994 expect(_getTopLevelVarType(ar.unit, 'A'), 'double');
1043 } 995 }
1044 } 996 }
1045 997
1046 test_removeFile_changeFile_notAnalyzed() async { 998 test_removeFile_changeFile_notAnalyzed() async {
1047 _addTestFile('main() {}'); 999 addTestFile('main() {}');
1048 1000
1049 // We have a result. 1001 // We have a result.
1050 await _waitForIdle(); 1002 await _waitForIdle();
1051 expect(allResults, hasLength(1)); 1003 expect(allResults, hasLength(1));
1052 expect(allResults[0].path, testFile); 1004 expect(allResults[0].path, testFile);
1053 allResults.clear(); 1005 allResults.clear();
1054 1006
1055 // Remove the file and send the change notification. 1007 // Remove the file and send the change notification.
1056 // The change notification does nothing, because the file is explicitly 1008 // The change notification does nothing, because the file is explicitly
1057 // or implicitly analyzed. 1009 // or implicitly analyzed.
1058 driver.removeFile(testFile); 1010 driver.removeFile(testFile);
1059 driver.changeFile(testFile); 1011 driver.changeFile(testFile);
1060 1012
1061 await _waitForIdle(); 1013 await _waitForIdle();
1062 expect(allResults, isEmpty); 1014 expect(allResults, isEmpty);
1063 } 1015 }
1064 1016
1065 test_results_priority() async { 1017 test_results_priority() async {
1066 String content = 'int f() => 42;'; 1018 String content = 'int f() => 42;';
1067 _addTestFile(content, priority: true); 1019 addTestFile(content, priority: true);
1068 1020
1069 await _waitForIdle(); 1021 await _waitForIdle();
1070 1022
1071 expect(allResults, hasLength(1)); 1023 expect(allResults, hasLength(1));
1072 AnalysisResult result = allResults.single; 1024 AnalysisResult result = allResults.single;
1073 expect(result.path, testFile); 1025 expect(result.path, testFile);
1074 expect(result.uri.toString(), 'package:test/test.dart'); 1026 expect(result.uri.toString(), 'package:test/test.dart');
1075 expect(result.content, content); 1027 expect(result.content, content);
1076 expect(result.contentHash, _md5(content)); 1028 expect(result.contentHash, _md5(content));
1077 expect(result.unit, isNotNull); 1029 expect(result.unit, isNotNull);
(...skipping 20 matching lines...) Expand all
1098 1050
1099 expect(allResults, hasLength(3)); 1051 expect(allResults, hasLength(3));
1100 AnalysisResult result = allResults[0]; 1052 AnalysisResult result = allResults[0];
1101 expect(result.path, b); 1053 expect(result.path, b);
1102 expect(result.unit, isNotNull); 1054 expect(result.unit, isNotNull);
1103 expect(result.errors, hasLength(0)); 1055 expect(result.errors, hasLength(0));
1104 } 1056 }
1105 1057
1106 test_results_regular() async { 1058 test_results_regular() async {
1107 String content = 'int f() => 42;'; 1059 String content = 'int f() => 42;';
1108 _addTestFile(content); 1060 addTestFile(content);
1109 await _waitForIdle(); 1061 await _waitForIdle();
1110 1062
1111 expect(allResults, hasLength(1)); 1063 expect(allResults, hasLength(1));
1112 AnalysisResult result = allResults.single; 1064 AnalysisResult result = allResults.single;
1113 expect(result.path, testFile); 1065 expect(result.path, testFile);
1114 expect(result.uri.toString(), 'package:test/test.dart'); 1066 expect(result.uri.toString(), 'package:test/test.dart');
1115 expect(result.content, isNull); 1067 expect(result.content, isNull);
1116 expect(result.contentHash, _md5(content)); 1068 expect(result.contentHash, _md5(content));
1117 expect(result.unit, isNull); 1069 expect(result.unit, isNull);
1118 expect(result.errors, hasLength(0)); 1070 expect(result.errors, hasLength(0));
1119 } 1071 }
1120 1072
1121 test_results_status() async { 1073 test_results_status() async {
1122 _addTestFile('int f() => 42;'); 1074 addTestFile('int f() => 42;');
1123 await _waitForIdle(); 1075 await _waitForIdle();
1124 1076
1125 expect(allStatuses, hasLength(2)); 1077 expect(allStatuses, hasLength(2));
1126 expect(allStatuses[0].isAnalyzing, isTrue); 1078 expect(allStatuses[0].isAnalyzing, isTrue);
1127 expect(allStatuses[0].isIdle, isFalse); 1079 expect(allStatuses[0].isIdle, isFalse);
1128 expect(allStatuses[1].isAnalyzing, isFalse); 1080 expect(allStatuses[1].isAnalyzing, isFalse);
1129 expect(allStatuses[1].isIdle, isTrue); 1081 expect(allStatuses[1].isIdle, isTrue);
1130 } 1082 }
1131 1083
1132 void _addTestFile(String content, {bool priority: false}) {
1133 provider.newFile(testFile, content);
1134 driver.addFile(testFile);
1135 if (priority) {
1136 driver.priorityFiles = [testFile];
1137 }
1138 }
1139
1140 ClassDeclaration _getClass(CompilationUnit unit, String name) { 1084 ClassDeclaration _getClass(CompilationUnit unit, String name) {
1141 for (CompilationUnitMember declaration in unit.declarations) { 1085 for (CompilationUnitMember declaration in unit.declarations) {
1142 if (declaration is ClassDeclaration) { 1086 if (declaration is ClassDeclaration) {
1143 if (declaration.name.name == name) { 1087 if (declaration.name.name == name) {
1144 return declaration; 1088 return declaration;
1145 } 1089 }
1146 } 1090 }
1147 } 1091 }
1148 fail('Cannot find the class $name in\n$unit'); 1092 fail('Cannot find the class $name in\n$unit');
1149 return null; 1093 return null;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 String _p(String path) => provider.convertPath(path); 1170 String _p(String path) => provider.convertPath(path);
1227 1171
1228 Future<Null> _waitForIdle() async { 1172 Future<Null> _waitForIdle() async {
1229 await idleStatusMonitor.signal; 1173 await idleStatusMonitor.signal;
1230 } 1174 }
1231 1175
1232 static String _md5(String content) { 1176 static String _md5(String content) {
1233 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 1177 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
1234 } 1178 }
1235 } 1179 }
1236
1237 class _Monitor {
1238 Completer<Null> _completer = new Completer<Null>();
1239
1240 Future<Null> get signal async {
1241 await _completer.future;
1242 _completer = new Completer<Null>();
1243 }
1244
1245 void notify() {
1246 if (!_completer.isCompleted) {
1247 _completer.complete(null);
1248 }
1249 }
1250 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/dart/analysis/base.dart ('k') | pkg/analyzer/test/src/dart/analysis/index_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698