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

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

Issue 2550093011: Fix race condition with 'knownFiles'. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 expect(driver.knownFiles, contains(a)); 929 expect(driver.knownFiles, contains(a));
930 expect(driver.knownFiles, contains(b)); 930 expect(driver.knownFiles, contains(b));
931 931
932 driver.removeFile(a); 932 driver.removeFile(a);
933 933
934 // a.dart was removed, but we don't clean up the file state state yet. 934 // a.dart was removed, but we don't clean up the file state state yet.
935 expect(driver.knownFiles, contains(a)); 935 expect(driver.knownFiles, contains(a));
936 expect(driver.knownFiles, contains(b)); 936 expect(driver.knownFiles, contains(b));
937 } 937 }
938 938
939 test_knownFiles_beforeAnalysis() async {
940 var a = _p('/test/lib/a.dart');
941 var b = _p('/test/lib/b.dart');
942
943 provider.newFile(a, '');
944
945 driver.addFile(a);
946 expect(driver.knownFiles, contains(a));
947 expect(driver.knownFiles, isNot(contains(b)));
948
949 // Remove 'a.dart'.
950 // It has been no analysis yet, so 'a.dart' is not in the file state, only
951 // in 'added' files. So, it disappears when removed.
952 driver.removeFile(a);
953 expect(driver.knownFiles, isNot(contains(a)));
954 expect(driver.knownFiles, isNot(contains(b)));
955 }
956
939 test_parseFile_shouldRefresh() async { 957 test_parseFile_shouldRefresh() async {
940 var p = _p('/test/bin/a.dart'); 958 var p = _p('/test/bin/a.dart');
941 959
942 provider.newFile(p, 'class A {}'); 960 provider.newFile(p, 'class A {}');
943 driver.addFile(p); 961 driver.addFile(p);
944 962
945 // Get the result, so force the file reading. 963 // Get the result, so force the file reading.
946 await driver.getResult(p); 964 await driver.getResult(p);
947 965
948 // Update the file. 966 // Update the file.
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 String _p(String path) => provider.convertPath(path); 1449 String _p(String path) => provider.convertPath(path);
1432 1450
1433 Future<Null> _waitForIdle() async { 1451 Future<Null> _waitForIdle() async {
1434 await idleStatusMonitor.signal; 1452 await idleStatusMonitor.signal;
1435 } 1453 }
1436 1454
1437 static String _md5(String content) { 1455 static String _md5(String content) {
1438 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 1456 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
1439 } 1457 }
1440 } 1458 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698