| 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 test.analysis_server.src.single_context_manager; | 5 library test.analysis_server.src.single_context_manager; |
| 6 | 6 |
| 7 import 'dart:core' hide Resource; | 7 import 'dart:core' hide Resource; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/single_context_manager.dart'; | 9 import 'package:analysis_server/src/single_context_manager.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // empty folder initially | 377 // empty folder initially |
| 378 callbacks.assertContextFiles(project, []); | 378 callbacks.assertContextFiles(project, []); |
| 379 // add file | 379 // add file |
| 380 String file = '$project/foo.dart'; | 380 String file = '$project/foo.dart'; |
| 381 resourceProvider.newFile(file, 'contents'); | 381 resourceProvider.newFile(file, 'contents'); |
| 382 // the file was added | 382 // the file was added |
| 383 await pumpEventQueue(); | 383 await pumpEventQueue(); |
| 384 callbacks.assertContextFiles(project, [file]); | 384 callbacks.assertContextFiles(project, [file]); |
| 385 } | 385 } |
| 386 | 386 |
| 387 test_watch_addFile_afterChangingRoots() async { |
| 388 String contextPath = '/context'; |
| 389 String root1 = '$contextPath/root1'; |
| 390 String root2 = '$contextPath/root2'; |
| 391 String file1 = '$root1/file1.dart'; |
| 392 String file2 = '$root2/file2.dart'; |
| 393 manager.setRoots(<String>[root1], <String>[], <String, String>{}); |
| 394 manager.setRoots(<String>[root2], <String>[], <String, String>{}); |
| 395 manager.setRoots(<String>[root1, root2], <String>[], <String, String>{}); |
| 396 manager.setRoots(<String>[root2], <String>[], <String, String>{}); |
| 397 // empty folder initially |
| 398 callbacks.assertContextFiles(root2, []); |
| 399 // add files |
| 400 resourceProvider.newFile(file1, ''); |
| 401 resourceProvider.newFile(file2, ''); |
| 402 // the file was added |
| 403 await pumpEventQueue(); |
| 404 callbacks.assertContextFiles(root2, [file2]); |
| 405 } |
| 406 |
| 387 test_watch_addFile_excluded() async { | 407 test_watch_addFile_excluded() async { |
| 388 String project = '/project'; | 408 String project = '/project'; |
| 389 String folderA = '$project/aaa'; | 409 String folderA = '$project/aaa'; |
| 390 String folderB = '$project/bbb'; | 410 String folderB = '$project/bbb'; |
| 391 String fileA = '$folderA/a.dart'; | 411 String fileA = '$folderA/a.dart'; |
| 392 String fileB = '$folderB/b.dart'; | 412 String fileB = '$folderB/b.dart'; |
| 393 // create files | 413 // create files |
| 394 resourceProvider.newFile(fileA, 'library a;'); | 414 resourceProvider.newFile(fileA, 'library a;'); |
| 395 // set roots | 415 // set roots |
| 396 manager.setRoots(<String>[project], <String>[folderB], <String, String>{}); | 416 manager.setRoots(<String>[project], <String>[folderB], <String, String>{}); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 manager.processPlugins(plugins); | 530 manager.processPlugins(plugins); |
| 511 } | 531 } |
| 512 } | 532 } |
| 513 | 533 |
| 514 class TestUriResolver extends UriResolver { | 534 class TestUriResolver extends UriResolver { |
| 515 @override | 535 @override |
| 516 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 536 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 517 return null; | 537 return null; |
| 518 } | 538 } |
| 519 } | 539 } |
| OLD | NEW |