| Index: pkg/analyzer/test/src/dart/analysis/file_state_test.dart
|
| diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
|
| index 7308a02e793dbff5f85cf80acc6c7573290edb51..789604d0153c532fce76cf8d990bcfb0f2d8fdb2 100644
|
| --- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
|
| +++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
|
| @@ -2,6 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +import 'dart:async';
|
| import 'dart:convert';
|
| import 'dart:typed_data';
|
|
|
| @@ -562,6 +563,47 @@ part 'not-a2.dart';
|
| expect(fileSystemState.hasUri(generatedPath), isTrue);
|
| }
|
|
|
| + test_knownFilesSetChanges() async {
|
| + fileSystemState.test.knownFilesDelay = new Duration(milliseconds: 5);
|
| +
|
| + String a = _p('/test/lib/a.dart');
|
| + String b = _p('/test/lib/b.dart');
|
| + String c = _p('/test/lib/c.dart');
|
| + provider.newFile(
|
| + a,
|
| + r'''
|
| +import 'b.dart';
|
| +''');
|
| + provider.newFile(b, '');
|
| + provider.newFile(c, '');
|
| +
|
| + Stream<KnownFilesSetChange> broadcastEvents =
|
| + fileSystemState.knownFilesSetChanges.asBroadcastStream();
|
| +
|
| + FileState file = fileSystemState.getFileForPath(a);
|
| + {
|
| + KnownFilesSetChange event = await broadcastEvents.first;
|
| + expect(event.added, contains(a));
|
| + expect(event.added, contains(b));
|
| + expect(event.removed, isEmpty);
|
| + }
|
| +
|
| + // Update a.dart to import c.dart and refresh.
|
| + // So, c.dart should be reported as added in the next change event.
|
| + provider.newFile(
|
| + a,
|
| + r'''
|
| +import 'b.dart';
|
| +import 'c.dart';
|
| +''');
|
| + file.refresh();
|
| + {
|
| + KnownFilesSetChange event = await broadcastEvents.first;
|
| + expect(event.added, contains(c));
|
| + expect(event.removed, isEmpty);
|
| + }
|
| + }
|
| +
|
| test_referencedNames() {
|
| String path = _p('/aaa/lib/a.dart');
|
| provider.newFile(
|
|
|