Clean up some tests to make conversion of contributor tests easier

Change-Id: I801970b4b88b883b2219badcefb7e1c84517d592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 5c8e199..4eb39f1 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -81,10 +81,6 @@
 
   String get workspaceRootPath => '/home';
 
-  void addSource(String path, String content) {
-    newFile(path, content);
-  }
-
   Future<void> analyzeTestPackageFiles() async {
     var analysisContext = contextFor(testPackageRootPath);
     var files = analysisContext.contextRoot.analyzedFiles().toList();
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index 7ca6d2f..45c5ca3 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -30,16 +30,10 @@
   late FindNode findNode;
   late FindElement findElement;
 
-  @override
-  void addSource(String path, String content) {
-    content = normalizeSource(content);
-    super.addSource(path, content);
-  }
-
   void addTestSource(String code) {
     code = normalizeSource(code);
     testCode = code;
-    addSource(testFile, code);
+    newFile(testFile, code);
   }
 
   int findEnd(String search) {
diff --git a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
index c13ef60..8d06442 100644
--- a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
@@ -46,17 +46,17 @@
 
   Future<void> test_Combinator_hide() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
       library libAB;
       part "ab_part.dart";
       class A { }
       class B { }''');
-    addSource('$testPackageLibPath/ab_part.dart', '''
+    newFile('$testPackageLibPath/ab_part.dart', '''
       part of libAB;
       var T1;
       PB F1() => new PB();
       class PB { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
       class C { }
       class D { }''');
     addTestSource('''
@@ -85,20 +85,20 @@
 
   Future<void> test_Combinator_show() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
       library libAB;
       part "ab_part.dart";
       class A { }
       class B { }
       class _AB''');
-    addSource('$testPackageLibPath/ab_part.dart', '''
+    newFile('$testPackageLibPath/ab_part.dart', '''
       part of libAB;
       var T1;
       PB F1() => new PB();
       typedef PB2 F2(int blat);
       class Clz = Object with Object;
       class PB { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
       class C { }
       class D { }''');
     addTestSource('''
@@ -132,11 +132,11 @@
   }
 
   Future<void> test_Combinator_show_export_withShow() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {}
 class B {}
 ''');
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 export 'a.dart' show A;
 ''');
     addTestSource(r'''
@@ -154,10 +154,10 @@
   }
 
   Future<void> test_Combinator_show_recursive() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {}
 ''');
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 export 'a.dart';
 export 'b.dart';
 class B {}
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 090cece..00f91eb 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -105,7 +105,7 @@
     expect(nextOffset, equals(-1), reason: 'too many ^');
     content = content.substring(0, _completionOffset) +
         content.substring(_completionOffset + 1);
-    addSource(testFile, content);
+    newFile(testFile, content);
   }
 
   /// A variant of [addTestSource] that can be invoked more than once,
@@ -117,7 +117,7 @@
     expect(nextOffset, equals(-1), reason: 'too many ^');
     content = content.substring(0, _completionOffset) +
         content.substring(_completionOffset + 1);
-    addSource(testFile, content);
+    newFile(testFile, content);
     driverFor(testFile).changeFile(testFile);
   }
 
@@ -647,7 +647,7 @@
   }
 
   void resolveSource(String path, String content) {
-    addSource(path, content);
+    newFile(path, content);
   }
 
   @override
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index e67c011..2833eb8 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -41,7 +41,7 @@
 class ImportedReferenceContributorTest extends DartCompletionContributorTest
     with ImportedReferenceContributorMixin {
   Future<void> test_Annotation_typeArguments() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class C {}
 typedef T1 = void Function();
 typedef T2 = List<int>;
@@ -142,7 +142,7 @@
   Future<void>
       test_ArgumentList_InstanceCreationExpression_functionalArg() async {
     // ArgumentList  InstanceCreationExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         class A { A(f()) { } }
         bool hasLength(int expected) { }
@@ -172,7 +172,7 @@
 
   Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
     // ArgumentList  InstanceCreationExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         typedef Funct();
         class A { A(Funct f) { } }
@@ -255,7 +255,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         class A { A(f()) { } }
         bool hasLength(int expected) { }
@@ -285,7 +285,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         class A { A(f()) { } }
         bool hasLength(int expected) { }
@@ -314,7 +314,7 @@
   Future<void> test_ArgumentList_namedParam() async {
     // SimpleIdentifier  NamedExpression  ArgumentList  MethodInvocation
     // ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         bool hasLength(int expected) { }''');
     addTestSource('''
@@ -357,7 +357,7 @@
     // value to the type it already has.
 
     // SimpleIdentifier  NamedType  AsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
           foo() { }
           class A {} class B extends A {} class C extends B {}
           class X {X.c(); X._d(); z() {}}''');
@@ -384,7 +384,7 @@
     // value to the type it already has.
 
     // SimpleIdentifier  NamedType  AsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
           foo() { }
           class A {} class B implements A {} class C implements B {}
           class X {X.c(); X._d(); z() {}}''');
@@ -553,7 +553,7 @@
 
   Future<void> test_AwaitExpression_inherited() async {
     // SimpleIdentifier  AwaitExpression  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib libB;
 class A {
   Future y() async { return 0; }
@@ -607,21 +607,21 @@
 
   Future<void> test_Block() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -710,21 +710,21 @@
 
   Future<void> test_Block_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -823,21 +823,21 @@
 
   Future<void> test_Block_final_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -924,21 +924,21 @@
 
   Future<void> test_Block_final_var() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -1027,16 +1027,16 @@
         class A {int x;}
         @deprecated D1() {int x;}
         class _B { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class DF { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         class D3 { }
         int T3;
@@ -1099,7 +1099,7 @@
 
   Future<void> test_Block_inherited_imported() async {
     // Block  BlockFunctionBody  MethodDeclaration  ClassDeclaration
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
         class E extends F { var e1; e2() { } }
@@ -1153,21 +1153,21 @@
   }
 
   Future<void> test_Block_local_function() async {
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -1205,21 +1205,21 @@
 
   Future<void> test_Block_partial_results() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
         class EE { }
         class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -1257,7 +1257,7 @@
 
   Future<void> test_CascadeExpression_selector1() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import 'b.dart';
@@ -1282,7 +1282,7 @@
 
   Future<void> test_CascadeExpression_selector2() async {
     // SimpleIdentifier  PropertyAccess  CascadeExpression  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import 'b.dart';
@@ -1305,7 +1305,7 @@
 
   Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import 'b.dart';
@@ -1400,7 +1400,7 @@
 
   Future<void> test_ClassDeclaration_body() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         const topLevel = 1;
         class B { }''');
     addTestSource('''
@@ -1427,7 +1427,7 @@
 
   Future<void> test_ClassDeclaration_body_annotation() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B {
           const B();
           B.named();
@@ -1459,7 +1459,7 @@
 
   Future<void> test_ClassDeclaration_body_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1480,7 +1480,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1501,7 +1501,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field2() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as Soo;
@@ -1522,7 +1522,7 @@
 
   Future<void> test_ClassDeclaration_body_final_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1543,7 +1543,7 @@
 
   Future<void> test_ClassDeclaration_body_final_var() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1564,17 +1564,17 @@
 
   Future<void> test_Combinator_hide() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         library libAB;
         part 'partAB.dart';
         class A { }
         class B { }''');
-    addSource('/partAB.dart', '''
+    newFile('/partAB.dart', '''
         part of libAB;
         var T1;
         PB F1() => new PB();
         class PB { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         class C { }
         class D { }''');
     addTestSource('''
@@ -1588,19 +1588,19 @@
 
   Future<void> test_Combinator_show() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
         library libAB;
         part 'partAB.dart';
         class A { }
         class B { }''');
-    addSource('/partAB.dart', '''
+    newFile('/partAB.dart', '''
         part of libAB;
         var T1;
         PB F1() => new PB();
         typedef PB2 F2(int blat);
         class Clz = Object with Object;
         class PB { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
         class C { }
         class D { }''');
     addTestSource('''
@@ -1614,7 +1614,7 @@
 
   Future<void> test_ConditionalExpression_elseExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1663,7 +1663,7 @@
 
   Future<void> test_ConditionalExpression_partial_thenExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1712,7 +1712,7 @@
 
   Future<void> test_ConditionalExpression_thenExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1733,7 +1733,7 @@
   Future<void> test_ConstructorName_importedClass() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -1758,7 +1758,7 @@
   Future<void> test_ConstructorName_importedFactory() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -1859,7 +1859,7 @@
   }
 
   Future<void> test_doc_class() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 library A;
 /// My class.
 /// Short description.
@@ -1921,7 +1921,7 @@
   }
 
   Future<void> test_enum() async {
-    addSource('$testPackageLibPath/a.dart', 'library A; enum E { one, two }');
+    newFile('$testPackageLibPath/a.dart', 'library A; enum E { one, two }');
     addTestSource('import "a.dart"; void f() {^}');
     await computeSuggestions();
     assertSuggestEnum('E');
@@ -1930,7 +1930,7 @@
   }
 
   Future<void> test_enum_deprecated() async {
-    addSource('$testPackageLibPath/a.dart',
+    newFile('$testPackageLibPath/a.dart',
         'library A; @deprecated enum E { one, two }');
     addTestSource('import "a.dart"; void f() {^}');
     await computeSuggestions();
@@ -1942,7 +1942,7 @@
   }
 
   Future<void> test_enum_filter() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 enum E { one, two }
 enum F { three, four }
 ''');
@@ -1998,7 +1998,7 @@
 
   Future<void> test_ExpressionStatement_name() async {
     // ExpressionStatement  Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         B T1;
         class B{}''');
     addTestSource('''
@@ -2058,7 +2058,7 @@
   Future<void> test_FieldDeclaration_name_typed() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {A ^}''');
@@ -2070,7 +2070,7 @@
   Future<void> test_FieldDeclaration_name_var() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {var ^}''');
@@ -2082,7 +2082,7 @@
   Future<void> test_FieldDeclaration_type() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {^ foo;) ''');
@@ -2095,7 +2095,7 @@
   Future<void> test_FieldDeclaration_type_after_comment1() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {
@@ -2111,7 +2111,7 @@
   Future<void> test_FieldDeclaration_type_after_comment2() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {
@@ -2127,7 +2127,7 @@
   Future<void> test_FieldDeclaration_type_after_comment3() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {
@@ -2143,7 +2143,7 @@
   Future<void> test_FieldDeclaration_type_without_semicolon() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         class C {^ foo} ''');
@@ -2639,7 +2639,7 @@
   }
 
   Future<void> test_functionTypeAlias_genericTypeAlias() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef F = void Function();
 ''');
     addTestSource(r'''
@@ -2655,7 +2655,7 @@
   }
 
   Future<void> test_functionTypeAlias_old() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef void F();
 ''');
     addTestSource(r'''
@@ -2747,7 +2747,7 @@
   }
 
   Future<void> test_implicitCreation() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   A.a1();
   A.a2();
@@ -2816,7 +2816,7 @@
 
   Future<void> test_IndexExpression2() async {
     // SimpleIdentifier IndexExpression ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -2889,7 +2889,7 @@
   }
 
   Future<void> test_InstanceCreationExpression_abstractClass() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 abstract class A {
   A();
   A.generative();
@@ -2912,7 +2912,7 @@
 
   Future<void>
       test_InstanceCreationExpression_abstractClass_implicitConstructor() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 abstract class A {}
 ''');
     addTestSource('''
@@ -2928,7 +2928,7 @@
   }
 
   Future<void> test_InstanceCreationExpression_filter() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {}
 class B extends A {}
 class C implements A {}
@@ -2951,7 +2951,7 @@
 
   Future<void> test_InstanceCreationExpression_imported() async {
     // SimpleIdentifier  NamedType  ConstructorName  InstanceCreationExpression
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {A(this.x) { } int x;}''');
@@ -2994,7 +2994,7 @@
 
   Future<void> test_InstanceCreationExpression_unimported() async {
     // SimpleIdentifier  NamedType  ConstructorName  InstanceCreationExpression
-    addSource('$testPackageLibPath/ab.dart', 'class Clip { }');
+    newFile('$testPackageLibPath/ab.dart', 'class Clip { }');
     addTestSource('class A {foo(){new C^}}');
 
     await computeSuggestions();
@@ -3018,7 +3018,7 @@
 
   Future<void> test_InterpolationExpression() async {
     // SimpleIdentifier  InterpolationExpression  StringInterpolation
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3052,7 +3052,7 @@
 
   Future<void> test_InterpolationExpression_block() async {
     // SimpleIdentifier  InterpolationExpression  StringInterpolation
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3127,7 +3127,7 @@
 
   Future<void> test_IsExpression() async {
     // SimpleIdentifier  NamedType  IsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo() { }
         class X {X.c(); X._d(); z() {}}''');
@@ -3202,7 +3202,7 @@
     // value to the type it already has.
 
     // SimpleIdentifier  NamedType  IsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         foo() { }
         class A {} class B extends A {} class C extends B {}
         class X {X.c(); X._d(); z() {}}''');
@@ -3229,7 +3229,7 @@
     // value to the type it already has.
 
     // SimpleIdentifier  NamedType  IsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         foo() { }
         class A {} class B implements A {} class C implements B {}
         class X {X.c(); X._d(); z() {}}''');
@@ -3311,7 +3311,7 @@
 
   Future<void> test_MapLiteralEntry() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3349,7 +3349,7 @@
 
   Future<void> test_MapLiteralEntry1() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3544,7 +3544,7 @@
 
   Future<void> test_MethodDeclaration_body_static() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/c.dart', '''
+    newFile('$testPackageLibPath/c.dart', '''
         class C {
           c1() {}
           var c2;
@@ -3784,7 +3784,7 @@
   }
 
   Future<void> test_MethodTypeArgumentList() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {}
 class B {}
 ''');
@@ -3825,7 +3825,7 @@
   }
 
   Future<void> test_mixin_ordering() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class B {}
 class M1 {
   void m() {}
@@ -3859,7 +3859,7 @@
   }
 
   Future<void> test_no_parameters_field() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int x;
 ''');
     addTestSource('''
@@ -3889,7 +3889,7 @@
   }
 
   Future<void> test_no_parameters_setter() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 set x(int value) {};
 ''');
     addTestSource('''
@@ -3912,12 +3912,12 @@
 
   Future<void> test_partFile_TypeName() async {
     // SimpleIdentifier  NamedType  ConstructorName
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
         class X {X.c(); X._d(); z() {}}''');
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library libA;
         import 'b.dart';
         part "test.dart";
@@ -3949,12 +3949,12 @@
 
   Future<void> test_partFile_TypeName2() async {
     // SimpleIdentifier  NamedType  ConstructorName
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib libB;
         int T1;
         F1() { }
         class X {X.c(); X._d(); z() {}}''');
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         part of libA;
         class B { }''');
     addTestSource('''
@@ -3984,7 +3984,7 @@
 
   Future<void> test_PrefixedIdentifier_class_const() async {
     // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class I {
           static const scI = 'boo';
@@ -4031,7 +4031,7 @@
 
   Future<void> test_PrefixedIdentifier_class_imported() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class I {X get f => new A();get _g => new A();}
         class A implements I {
@@ -4110,7 +4110,7 @@
 
   Future<void> test_PrefixedIdentifier_library() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         var T1;
         class X { }
@@ -4137,7 +4137,7 @@
 
   Future<void> test_PrefixedIdentifier_library_typesOnly() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         var T1;
         class X { }
@@ -4164,7 +4164,7 @@
 
   Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         var T1;
         class X { }
@@ -4191,7 +4191,7 @@
 
   Future<void> test_PrefixedIdentifier_parameter() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class _W {M y; var _z;}
         class X extends _W {}
@@ -4210,7 +4210,7 @@
 
   Future<void> test_PrefixedIdentifier_prefix() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         class A {static int bar = 10;}
         _B() {}''');
     addTestSource('''
@@ -4356,7 +4356,7 @@
 
   Future<void> test_PropertyAccess_noTarget() async {
     // SimpleIdentifier  PropertyAccess  ExpressionStatement
-    addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
+    newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
     addTestSource('class C {foo(){.^}}');
 
     await computeSuggestions();
@@ -4365,7 +4365,7 @@
 
   Future<void> test_PropertyAccess_noTarget2() async {
     // SimpleIdentifier  PropertyAccess  ExpressionStatement
-    addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
+    newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
     addTestSource('void f() {.^}');
 
     await computeSuggestions();
@@ -4637,7 +4637,7 @@
   Future<void> test_TopLevelVariableDeclaration_type() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // TopLevelVariableDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         ^ foo; ''');
@@ -4650,7 +4650,7 @@
   Future<void> test_TopLevelVariableDeclaration_type_after_comment1() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // TopLevelVariableDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         // comment
@@ -4664,7 +4664,7 @@
   Future<void> test_TopLevelVariableDeclaration_type_after_comment2() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // TopLevelVariableDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         /* comment */
@@ -4678,7 +4678,7 @@
   Future<void> test_TopLevelVariableDeclaration_type_after_comment3() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // TopLevelVariableDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         /// some dartdoc
@@ -4692,7 +4692,7 @@
   Future<void> test_TopLevelVariableDeclaration_type_without_semicolon() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // TopLevelVariableDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import 'a.dart';
         ^ foo ''');
@@ -4796,7 +4796,7 @@
 
   Future<void> test_TypeArgumentList2() async {
     // NamedType  TypeArgumentList  NamedType
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         class C1 {int x;}
         F1() => 0;
         typedef String T1(int blat);''');
@@ -4856,7 +4856,7 @@
   Future<void> test_VariableDeclaration_name() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo() { }
         class _B { }
@@ -4883,7 +4883,7 @@
   Future<void> test_VariableDeclarationStatement_RHS() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo() { }
         class _B { }
diff --git a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
index b151532..2ccf801 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
@@ -34,7 +34,7 @@
 
   Future<void> test_extension() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 extension MyExt on int {}
 ''');
     addTestSource('''
@@ -172,7 +172,7 @@
 
   Future<void> test_PrefixedIdentifier_library() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 var T1;
 class X { }
@@ -198,11 +198,11 @@
   }
 
   Future<void> test_PrefixedIdentifier_library_export_withShow() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {}
 class B {}
 ''');
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 export 'a.dart' show A;
 ''');
     addTestSource(r'''
@@ -217,7 +217,7 @@
   }
 
   Future<void> test_PrefixedIdentifier_library_import_withShow() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {}
 class B {}
 ''');
diff --git a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
index d143e0a..7cd680f 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
@@ -50,21 +50,21 @@
 
   Future<void> test_Block() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -97,21 +97,21 @@
 
   Future<void> test_Block_final_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
 class EE { }
 class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -144,21 +144,21 @@
 
   Future<void> test_Block_final_var() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
 class EE { }
 class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -191,7 +191,7 @@
 
   Future<void> test_ClassDeclaration_body() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -206,7 +206,7 @@
 
   Future<void> test_ClassDeclaration_body_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -221,7 +221,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -236,7 +236,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field2() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as Soo;
@@ -251,7 +251,7 @@
 
   Future<void> test_ClassDeclaration_body_final_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -266,7 +266,7 @@
 
   Future<void> test_ClassDeclaration_body_final_var() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -280,7 +280,7 @@
   }
 
   Future<void> test_InstanceCreationExpression() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {foo(){var f; {var x;}}}
 class B {B(this.x, [String boo]) { } int x;}
 class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
@@ -299,11 +299,11 @@
   }
 
   Future<void> test_InstanceCreationExpression_inPart() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {foo(){var f; {var x;}}}
 class B {B(this.x, [String boo]) { } int x;}
 class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 library testB;
 import "a.dart" as t;
 import "dart:math" as math;
@@ -318,11 +318,11 @@
   }
 
   Future<void> test_InstanceCreationExpression_inPart_detached() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {foo(){var f; {var x;}}}
 class B {B(this.x, [String boo]) { } int x;}
 class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 library testB;
 import "a.dart" as t;
 import "dart:math" as math;
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 468796d..5fe9d76 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -125,7 +125,7 @@
 
   Future<void> test_ArgumentList() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 bool hasLength(int expected) { }
 void baz() { }''');
@@ -150,7 +150,7 @@
 
   Future<void> test_ArgumentList_imported_function() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 bool hasLength(int expected) { }
 expect(arg) { }
@@ -177,7 +177,7 @@
   Future<void>
       test_ArgumentList_InstanceCreationExpression_functionalArg() async {
     // ArgumentList  InstanceCreationExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 class A { A(f()) { } }
 bool hasLength(int expected) { }
@@ -206,7 +206,7 @@
 
   Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
     // ArgumentList  InstanceCreationExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 typedef Funct();
 class A { A(Funct f) { } }
@@ -236,7 +236,7 @@
 
   Future<void> test_ArgumentList_local_function() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 bool hasLength(int expected) { }
 void baz() { }''');
@@ -262,7 +262,7 @@
 
   Future<void> test_ArgumentList_local_method() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 bool hasLength(int expected) { }
 void baz() { }''');
@@ -288,7 +288,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 class A { A(f()) { } }
 bool hasLength(int expected) { }
@@ -319,7 +319,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_functionalArg2() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 class A { A(f()) { } }
 bool hasLength(int expected) { }
@@ -355,7 +355,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 class A { A(f()) { } }
 bool hasLength(int expected) { }
@@ -380,7 +380,7 @@
   }
 
   Future<void> test_ArgumentList_namedFieldParam_tear_off() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 typedef void VoidCallback();
 
 class Button {
@@ -411,7 +411,7 @@
   Future<void> test_ArgumentList_namedParam() async {
     // SimpleIdentifier  NamedExpression  ArgumentList  MethodInvocation
     // ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library A;
 bool hasLength(int expected) { }''');
     addTestSource('''
@@ -457,7 +457,7 @@
   }
 
   Future<void> test_ArgumentList_namedParam_tear_off() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 typedef void VoidCallback();
 
 class Button {
@@ -485,7 +485,7 @@
   }
 
   Future<void> test_ArgumentList_namedParam_tear_off_1() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 typedef void VoidCallback();
 
 class Button {
@@ -513,7 +513,7 @@
   }
 
   Future<void> test_ArgumentList_namedParam_tear_off_2() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 typedef void VoidCallback();
 
 class Button {
@@ -817,21 +817,21 @@
 
   Future<void> test_Block() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -910,21 +910,21 @@
 
   Future<void> test_Block_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -1023,21 +1023,21 @@
 
   Future<void> test_Block_final_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -1122,21 +1122,21 @@
 
   Future<void> test_Block_final_var() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -1220,21 +1220,21 @@
   }
 
   Future<void> test_Block_identifier_partial() async {
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 class D3 { }
 int T3;
@@ -1453,21 +1453,21 @@
   }
 
   Future<void> test_Block_local_function() async {
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 export "dart:math" hide max;
 class A {int x;}
 @deprecated D1() {int x;}
 class _B {boo() { partBoo() {}} }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 String T1;
 var _T2;
 class C { }
 class D { }''');
-    addSource('$testPackageLibPath/eef.dart', '''
+    newFile('$testPackageLibPath/eef.dart', '''
 class EE { }
 class F { }''');
-    addSource('$testPackageLibPath/g.dart', 'class G { }');
-    addSource('$testPackageLibPath/h.dart', '''
+    newFile('$testPackageLibPath/g.dart', 'class G { }');
+    newFile('$testPackageLibPath/h.dart', '''
 class H { }
 int T3;
 var _T4;'''); // not imported
@@ -1531,7 +1531,7 @@
 
   Future<void> test_CascadeExpression_selector1() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart";
@@ -1556,7 +1556,7 @@
 
   Future<void> test_CascadeExpression_selector2() async {
     // SimpleIdentifier  PropertyAccess  CascadeExpression  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart";
@@ -1579,7 +1579,7 @@
 
   Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart";
@@ -1685,7 +1685,7 @@
 
   Future<void> test_ClassDeclaration_body() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -1714,7 +1714,7 @@
 
   Future<void> test_ClassDeclaration_body_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -1735,7 +1735,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -1756,7 +1756,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field2() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as Soo;
@@ -1777,7 +1777,7 @@
 
   Future<void> test_ClassDeclaration_body_final_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -1798,7 +1798,7 @@
 
   Future<void> test_ClassDeclaration_body_final_var() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -1844,17 +1844,17 @@
 
   Future<void> test_Combinator_hide() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 library libAB;
 part 'partAB.dart';
 class A { }
 class B { }''');
-    addSource('/partAB.dart', '''
+    newFile('/partAB.dart', '''
 part of libAB;
 var T1;
 PB F1() => new PB();
 class PB { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 class C { }
 class D { }''');
     addTestSource('''
@@ -1868,19 +1868,19 @@
 
   Future<void> test_Combinator_show() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('$testPackageLibPath/ab.dart', '''
+    newFile('$testPackageLibPath/ab.dart', '''
 library libAB;
 part 'partAB.dart';
 class A { }
 class B { }''');
-    addSource('/partAB.dart', '''
+    newFile('/partAB.dart', '''
 part of libAB;
 var T1;
 PB F1() => new PB();
 typedef PB2 F2(int blat);
 class Clz = Object with Object;
 class PB { }''');
-    addSource('$testPackageLibPath/cd.dart', '''
+    newFile('$testPackageLibPath/cd.dart', '''
 class C { }
 class D { }''');
     addTestSource('''
@@ -1894,7 +1894,7 @@
 
   Future<void> test_ConditionalExpression_elseExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -1914,7 +1914,7 @@
 
   Future<void> test_ConditionalExpression_elseExpression_empty() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -1940,7 +1940,7 @@
 
   Future<void> test_ConditionalExpression_partial_thenExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -1960,7 +1960,7 @@
 
   Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -1986,7 +1986,7 @@
 
   Future<void> test_ConditionalExpression_thenExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -2073,7 +2073,7 @@
   Future<void> test_ConstructorName_importedClass() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 int T1;
 F1() { }
@@ -2098,7 +2098,7 @@
   Future<void> test_ConstructorName_importedFactory() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 int T1;
 F1() { }
@@ -2601,7 +2601,7 @@
 
   Future<void> test_ExpressionStatement_identifier() async {
     // SimpleIdentifier  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 _B F1() { }
 class A {int x;}
 class _B { }''');
@@ -2629,7 +2629,7 @@
 
   Future<void> test_ExpressionStatement_name() async {
     // ExpressionStatement  Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         B T1;
         class B{}''');
     addTestSource('''
@@ -2699,7 +2699,7 @@
 
   Future<void> test_extensionDeclaration_notInBody() async {
     // ExtensionDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -2752,7 +2752,7 @@
   Future<void> test_FieldDeclaration_name_typed() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import "a.dart";
         class C {A ^}''');
@@ -2764,7 +2764,7 @@
   Future<void> test_FieldDeclaration_name_var() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import "a.dart";
         class C {var ^}''');
@@ -3225,7 +3225,7 @@
 
   Future<void> test_FunctionDeclaration_returnType_afterComment() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -3256,7 +3256,7 @@
 
   Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
     // FunctionDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -3287,7 +3287,7 @@
 
   Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
     // FunctionDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -3553,7 +3553,7 @@
 
   Future<void> test_IndexExpression() async {
     // ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -3579,7 +3579,7 @@
 
   Future<void> test_IndexExpression2() async {
     // SimpleIdentifier IndexExpression ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {int x;}''');
@@ -3800,7 +3800,7 @@
 
   Future<void> test_InstanceCreationExpression_imported() async {
     // SimpleIdentifier  NamedType  ConstructorName  InstanceCreationExpression
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 class A {A(this.x) { } int x;}''');
@@ -3860,7 +3860,7 @@
 
   Future<void> test_InstanceCreationExpression_unimported() async {
     // SimpleIdentifier  NamedType  ConstructorName  InstanceCreationExpression
-    addSource('/testAB.dart', 'class Foo { }');
+    newFile('/testAB.dart', 'class Foo { }');
     addTestSource('class C {foo(){new F^}}');
     await computeSuggestions();
 
@@ -3902,7 +3902,7 @@
 
   Future<void> test_InterpolationExpression_block() async {
     // SimpleIdentifier  InterpolationExpression  StringInterpolation
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -3975,7 +3975,7 @@
 
   Future<void> test_IsExpression() async {
     // SimpleIdentifier  NamedType  IsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 foo() { }
 class X {X.c(); X._d(); z() {}}''');
@@ -4098,7 +4098,7 @@
   }
 
   Future<void> test_keyword() async {
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 int newT1;
 int T1;
@@ -4251,7 +4251,7 @@
 
   Future<void> test_MapLiteralEntry() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -4281,7 +4281,7 @@
 
   Future<void> test_MapLiteralEntry1() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -4303,7 +4303,7 @@
 
   Future<void> test_MapLiteralEntry2() async {
     // SimpleIdentifier  MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -4644,7 +4644,7 @@
 
   Future<void> test_MethodDeclaration_body_static() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/c.dart', '''
+    newFile('$testPackageLibPath/c.dart', '''
 class C {
   c1() {}
   var c2;
@@ -4821,7 +4821,7 @@
 
   Future<void> test_MethodDeclaration_returnType() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -4851,7 +4851,7 @@
 
   Future<void> test_MethodDeclaration_returnType_afterComment() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -4881,7 +4881,7 @@
 
   Future<void> test_MethodDeclaration_returnType_afterComment2() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -4911,7 +4911,7 @@
 
   Future<void> test_MethodDeclaration_returnType_afterComment3() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int T1;
 F1() { }
 typedef D1();
@@ -5068,7 +5068,7 @@
 
   Future<void> test_MixinDeclaration_body() async {
     // MixinDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 class B { }''');
     addTestSource('''
 import "b.dart" as x;
@@ -5312,7 +5312,7 @@
 
   Future<void> test_PrefixedIdentifier_class_const() async {
     // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 class I {
   static const scI = 'boo';
@@ -5359,7 +5359,7 @@
 
   Future<void> test_PrefixedIdentifier_class_imported() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 class I {X get f => new A();get _g => new A();}
 class A implements I {
@@ -5438,7 +5438,7 @@
 
   Future<void> test_PrefixedIdentifier_library() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 var T1;
 class X { }
@@ -5465,7 +5465,7 @@
 
   Future<void> test_PrefixedIdentifier_library_typesOnly() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 var T1;
 class X { }
@@ -5492,7 +5492,7 @@
 
   Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 var T1;
 class X { }
@@ -5519,7 +5519,7 @@
 
   Future<void> test_PrefixedIdentifier_parameter() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 class _W {M y; var _z;}
 class X extends _W {}
@@ -5538,7 +5538,7 @@
 
   Future<void> test_PrefixedIdentifier_prefix() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {static int bar = 10;}
 _B() {}''');
     addTestSource('''
@@ -5702,7 +5702,7 @@
 
   Future<void> test_PropertyAccess_noTarget() async {
     // SimpleIdentifier  PropertyAccess  ExpressionStatement
-    addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
+    newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
     addTestSource('class C {foo(){.^}}');
     await computeSuggestions();
 
@@ -5711,7 +5711,7 @@
 
   Future<void> test_PropertyAccess_noTarget2() async {
     // SimpleIdentifier  PropertyAccess  ExpressionStatement
-    addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
+    newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
     addTestSource('void f() {.^}');
     await computeSuggestions();
 
@@ -6183,7 +6183,7 @@
 
   Future<void> test_TypeArgumentList() async {
     // SimpleIdentifier  BinaryExpression  ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class C1 {int x;}
 F1() => 0;
 typedef String T1(int blat);''');
@@ -6210,7 +6210,7 @@
 
   Future<void> test_TypeArgumentList2() async {
     // NamedType  TypeArgumentList  NamedType
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class C1 {int x;}
 F1() => 0;
 typedef String T1(int blat);''');
@@ -6274,7 +6274,7 @@
   Future<void> test_VariableDeclaration_name() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 foo() { }
 class _B { }
@@ -6301,7 +6301,7 @@
   Future<void> test_VariableDeclarationStatement_RHS() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 foo() { }
 class _B { }
@@ -6326,7 +6326,7 @@
   Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
     // VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 lib B;
 foo1() { }
 void bar1() { }
diff --git a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
index 866331e..f433e2e8 100644
--- a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
@@ -297,7 +297,7 @@
   Future<void> test_ConstructorName_importedClass() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -325,7 +325,7 @@
   Future<void> test_ConstructorName_importedClass_unresolved() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -354,7 +354,7 @@
   Future<void> test_ConstructorName_importedFactory() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -455,7 +455,7 @@
 
   Future<void>
       test_importPrefix_className_typeArguments_period_nothing_functionTypeContext_matchingReturnType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A<T> {
   A.named();
   A.new();
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index 273da5f..2b6d216 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -33,7 +33,7 @@
   }
 
   Future<void> test_class_static_notPrivate() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   static int _f;
   static String get _g => '';
@@ -143,7 +143,7 @@
   }
 
   Future<void> test_extension_static_notPrivate() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 extension E {
   static int _f;
   static String get _g => '';
@@ -165,7 +165,7 @@
   }
 
   Future<void> test_implicitCreation() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   A.foo();
   A.bar();
@@ -186,7 +186,7 @@
 
   Future<void>
       test_implicitCreation_functionContextType_matchingReturnType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   A.foo();
   A.bar();
@@ -207,7 +207,7 @@
 
   Future<void>
       test_implicitCreation_functionContextType_notMatchingReturnType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   A.foo();
   A.bar();
@@ -371,7 +371,7 @@
 
   Future<void> test_PrefixedIdentifier_class_const() async {
     // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class I {
           static const scI = 'boo';
@@ -415,7 +415,7 @@
   }
 
   Future<void> test_simpleIdentifier_typeAlias_interfaceType_class() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   static int _privateField = 0;
   static int get _privateGetter => 0;
@@ -457,7 +457,7 @@
   }
 
   Future<void> test_simpleIdentifier_typeAlias_interfaceType_enum() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 enum E {
   aaa,
   _bbb,
diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
index d203469..73fd816 100644
--- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
@@ -119,7 +119,7 @@
 
   Future<void> test_ArgumentList() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         bool hasLength(int expected) { }
         void baz() { }''');
@@ -143,7 +143,7 @@
 
   Future<void> test_ArgumentList_imported_function() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         bool hasLength(int expected) { }
         expect(arg) { }
@@ -169,7 +169,7 @@
   Future<void>
       test_ArgumentList_InstanceCreationExpression_functionalArg() async {
     // ArgumentList  InstanceCreationExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         class A { A(f()) { } }
         bool hasLength(int expected) { }
@@ -196,7 +196,7 @@
 
   Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
     // ArgumentList  InstanceCreationExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         typedef Funct();
         class A { A(Funct f) { } }
@@ -224,7 +224,7 @@
 
   Future<void> test_ArgumentList_local_function() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         bool hasLength(int expected) { }
         void baz() { }''');
@@ -249,7 +249,7 @@
 
   Future<void> test_ArgumentList_local_method() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         bool hasLength(int expected) { }
         void baz() { }''');
@@ -274,7 +274,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         class A { A(f()) { } }
         bool hasLength(int expected) { }
@@ -301,7 +301,7 @@
 
   Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         class A { A(f()) { } }
         bool hasLength(int expected) { }
@@ -327,7 +327,7 @@
   Future<void> test_ArgumentList_namedParam() async {
     // SimpleIdentifier  NamedExpression  ArgumentList  MethodInvocation
     // ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library A;
         bool hasLength(int expected) { }''');
     addTestSource('''
@@ -504,21 +504,21 @@
 
   Future<void> test_Block() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
         class EE { }
         class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -596,21 +596,21 @@
 
   Future<void> test_Block_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
         class EE { }
         class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -708,21 +708,21 @@
 
   Future<void> test_Block_final_final() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
         class EE { }
         class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -806,21 +806,21 @@
 
   Future<void> test_Block_final_var() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
         class EE { }
         class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -903,21 +903,21 @@
   }
 
   Future<void> test_Block_identifier_partial() async {
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B { }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
         class EE { }
         class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
         class H { }
         class D3 { }
         int T3;
@@ -982,7 +982,7 @@
 
   Future<void> test_Block_inherited_imported() async {
     // Block  BlockFunctionBody  MethodDeclaration  ClassDeclaration
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
         class E extends F { var e1; e2() { } }
@@ -1035,21 +1035,21 @@
   }
 
   Future<void> test_Block_local_function() async {
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         export "dart:math" hide max;
         class A {int x;}
         @deprecated D1() {int x;}
         class _B {boo() { partBoo() {}} }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         String T1;
         var _T2;
         class C { }
         class D { }''');
-    addSource('/testEEF.dart', '''
+    newFile('/testEEF.dart', '''
         class EE { }
         class F { }''');
-    addSource('/testG.dart', 'class G { }');
-    addSource('/testH.dart', '''
+    newFile('/testG.dart', 'class G { }');
+    newFile('/testH.dart', '''
         class H { }
         int T3;
         var _T4;'''); // not imported
@@ -1098,7 +1098,7 @@
 
   Future<void> test_CascadeExpression_method1() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart";
@@ -1122,7 +1122,7 @@
 
   Future<void> test_CascadeExpression_selector1() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart";
@@ -1146,7 +1146,7 @@
 
   Future<void> test_CascadeExpression_selector2() async {
     // SimpleIdentifier  PropertyAccess  CascadeExpression  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart";
@@ -1168,7 +1168,7 @@
 
   Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
     // PropertyAccess  CascadeExpression  ExpressionStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart";
@@ -1257,7 +1257,7 @@
 
   Future<void> test_ClassDeclaration_body() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1276,7 +1276,7 @@
 
   Future<void> test_ClassDeclaration_body_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1295,7 +1295,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1314,7 +1314,7 @@
 
   Future<void> test_ClassDeclaration_body_final_field2() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as Soo;
@@ -1333,7 +1333,7 @@
 
   Future<void> test_ClassDeclaration_body_final_final() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1352,7 +1352,7 @@
 
   Future<void> test_ClassDeclaration_body_final_var() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         class B { }''');
     addTestSource('''
         import "b.dart" as x;
@@ -1371,17 +1371,17 @@
 
   Future<void> test_Combinator_hide() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         library libAB;
         part 'partAB.dart';
         class A { }
         class B { }''');
-    addSource('/partAB.dart', '''
+    newFile('/partAB.dart', '''
         part of libAB;
         var T1;
         PB F1() => PB();
         class PB { }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         class C { }
         class D { }''');
     addTestSource('''
@@ -1394,19 +1394,19 @@
 
   Future<void> test_Combinator_show() async {
     // SimpleIdentifier  HideCombinator  ImportDirective
-    addSource('/testAB.dart', '''
+    newFile('/testAB.dart', '''
         library libAB;
         part 'partAB.dart';
         class A { }
         class B { }''');
-    addSource('/partAB.dart', '''
+    newFile('/partAB.dart', '''
         part of libAB;
         var T1;
         PB F1() => PB();
         typedef PB2 F2(int blat);
         class Clz = Object with Object;
         class PB { }''');
-    addSource('/testCD.dart', '''
+    newFile('/testCD.dart', '''
         class C { }
         class D { }''');
     addTestSource('''
@@ -1419,7 +1419,7 @@
 
   Future<void> test_ConditionalExpression_elseExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1438,7 +1438,7 @@
 
   Future<void> test_ConditionalExpression_elseExpression_empty() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1463,7 +1463,7 @@
 
   Future<void> test_ConditionalExpression_partial_thenExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1482,7 +1482,7 @@
 
   Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1507,7 +1507,7 @@
 
   Future<void> test_ConditionalExpression_thenExpression() async {
     // SimpleIdentifier  ConditionalExpression  ReturnStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -1527,7 +1527,7 @@
   Future<void> test_ConstructorName_importedClass() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -1551,7 +1551,7 @@
   Future<void> test_ConstructorName_importedFactory() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType  ConstructorName
     // InstanceCreationExpression
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
@@ -1717,7 +1717,7 @@
 
   Future<void> test_ExpressionStatement_identifier() async {
     // SimpleIdentifier  ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         _B F1() { }
         class A {int x;}
         class _B { }''');
@@ -1743,7 +1743,7 @@
 
   Future<void> test_ExpressionStatement_name() async {
     // ExpressionStatement  Block  BlockFunctionBody  MethodDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         B T1;
         class B{}''');
     addTestSource('''
@@ -1770,7 +1770,7 @@
   Future<void> test_FieldDeclaration_name_typed() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import "a.dart";
         class C {A ^}''');
@@ -1781,7 +1781,7 @@
   Future<void> test_FieldDeclaration_name_var() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // FieldDeclaration
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
     addTestSource('''
         import "a.dart";
         class C {var ^}''');
@@ -1933,7 +1933,7 @@
 
   Future<void> test_FunctionDeclaration_returnType_afterComment() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -1962,7 +1962,7 @@
 
   Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
     // FunctionDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -1991,7 +1991,7 @@
 
   Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
     // FunctionDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2185,7 +2185,7 @@
 
   Future<void> test_IndexExpression() async {
     // ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -2210,7 +2210,7 @@
 
   Future<void> test_IndexExpression2() async {
     // SimpleIdentifier IndexExpression ExpressionStatement  Block
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {int x;}''');
@@ -2229,7 +2229,7 @@
 
   Future<void> test_InstanceCreationExpression_imported() async {
     // SimpleIdentifier  NamedType  ConstructorName  InstanceCreationExpression
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         class A {A(this.x) { } int x;}''');
@@ -2259,7 +2259,7 @@
 
   Future<void> test_InstanceCreationExpression_unimported() async {
     // SimpleIdentifier  NamedType  ConstructorName  InstanceCreationExpression
-    addSource('/testAB.dart', 'class Foo { }');
+    newFile('/testAB.dart', 'class Foo { }');
     addTestSource('class C {foo(){new F^}}');
     await computeSuggestions();
     expect(replacementOffset, completionOffset - 1);
@@ -2315,7 +2315,7 @@
 
   Future<void> test_InterpolationExpression() async {
     // SimpleIdentifier  InterpolationExpression  StringInterpolation
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2344,7 +2344,7 @@
 
   Future<void> test_InterpolationExpression_block() async {
     // SimpleIdentifier  InterpolationExpression  StringInterpolation
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2410,7 +2410,7 @@
 
   Future<void> test_IsExpression() async {
     // SimpleIdentifier  NamedType  IsExpression  IfStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo() { }
         class X {X.c(); X._d(); z() {}}''');
@@ -2483,7 +2483,7 @@
   }
 
   Future<void> test_keyword2() async {
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int newT1;
         int T1;
@@ -2543,8 +2543,8 @@
   }
 
   Future<void> test_libraryPrefix_with_exports() async {
-    addSource('$testPackageLibPath/a.dart', 'class A { }');
-    addSource('$testPackageLibPath/b.dart', 'export "a.dart"; class B { }');
+    newFile('$testPackageLibPath/a.dart', 'class A { }');
+    newFile('$testPackageLibPath/b.dart', 'export "a.dart"; class B { }');
     addTestSource('import "b.dart" as foo; void f() {foo.^} class C { }');
     await computeSuggestions();
     // Suggested by LibraryMemberContributor
@@ -2602,7 +2602,7 @@
 
   Future<void> test_MapLiteralEntry() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2629,7 +2629,7 @@
 
   Future<void> test_MapLiteralEntry1() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2649,7 +2649,7 @@
 
   Future<void> test_MapLiteralEntry2() async {
     // SimpleIdentifier  MapLiteralEntry  MapLiteral  VariableDeclaration
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2869,7 +2869,7 @@
 
   Future<void> test_MethodDeclaration_body_static() async {
     // Block  BlockFunctionBody  MethodDeclaration
-    addSource('/testC.dart', '''
+    newFile('/testC.dart', '''
         class C {
           c1() {}
           var c2;
@@ -2948,7 +2948,7 @@
 
   Future<void> test_MethodDeclaration_returnType() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -2976,7 +2976,7 @@
 
   Future<void> test_MethodDeclaration_returnType_afterComment() async {
     // ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3004,7 +3004,7 @@
 
   Future<void> test_MethodDeclaration_returnType_afterComment2() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3032,7 +3032,7 @@
 
   Future<void> test_MethodDeclaration_returnType_afterComment3() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         int T1;
         F1() { }
         typedef D1();
@@ -3279,12 +3279,12 @@
 
   Future<void> test_partFile_TypeName() async {
     // SimpleIdentifier  NamedType  ConstructorName
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
         class X {X.c(); X._d(); z() {}}''');
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         library libA;
         import "b.dart";
         part "${resourceProvider.pathContext.basename(testFile)}";
@@ -3311,12 +3311,12 @@
 
   Future<void> test_partFile_TypeName2() async {
     // SimpleIdentifier  NamedType  ConstructorName
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         int T1;
         F1() { }
         class X {X.c(); X._d(); z() {}}''');
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         part of libA;
         class B { }''');
     addTestSource('''
@@ -3343,7 +3343,7 @@
 
   Future<void> test_PrefixedIdentifier_class_const() async {
     // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class I {
           static const scI = 'boo';
@@ -3389,7 +3389,7 @@
 
   Future<void> test_PrefixedIdentifier_class_imported() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class I {X get f => A();get _g => A();}
         class A implements I {
@@ -3465,7 +3465,7 @@
 
   Future<void> test_PrefixedIdentifier_library() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         var T1;
         class X { }
@@ -3491,7 +3491,7 @@
 
   Future<void> test_PrefixedIdentifier_library_typesOnly() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         var T1;
         class X { }
@@ -3517,7 +3517,7 @@
 
   Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
     // SimpleIdentifier  PrefixedIdentifier  NamedType
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         var T1;
         class X { }
@@ -3543,7 +3543,7 @@
 
   Future<void> test_PrefixedIdentifier_parameter() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         class _W {M y; var _z;}
         class X extends _W {}
@@ -3561,7 +3561,7 @@
 
   Future<void> test_PrefixedIdentifier_prefix() async {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         class A {static int bar = 10;}
         _B() {}''');
     addTestSource('''
@@ -3697,7 +3697,7 @@
 
   Future<void> test_PropertyAccess_noTarget() async {
     // SimpleIdentifier  PropertyAccess  ExpressionStatement
-    addSource('/testAB.dart', 'class Foo { }');
+    newFile('/testAB.dart', 'class Foo { }');
     addTestSource('class C {foo(){.^}}');
     await computeSuggestions();
     assertNoSuggestions();
@@ -3705,7 +3705,7 @@
 
   Future<void> test_PropertyAccess_noTarget2() async {
     // SimpleIdentifier  PropertyAccess  ExpressionStatement
-    addSource('/testAB.dart', 'class Foo { }');
+    newFile('/testAB.dart', 'class Foo { }');
     addTestSource('void f() {.^}');
     await computeSuggestions();
     assertNoSuggestions();
@@ -4160,7 +4160,7 @@
 
   Future<void> test_TypeArgumentList() async {
     // SimpleIdentifier  BinaryExpression  ExpressionStatement
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         class C1 {int x;}
         F1() => 0;
         typedef String T1(int blat);''');
@@ -4185,7 +4185,7 @@
 
   Future<void> test_TypeArgumentList2() async {
     // NamedType  TypeArgumentList  NamedType
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
         class C1 {int x;}
         F1() => 0;
         typedef String T1(int blat);''');
@@ -4229,7 +4229,7 @@
   Future<void> test_VariableDeclaration_name() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement  Block
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo() { }
         class _B { }
@@ -4254,7 +4254,7 @@
   Future<void> test_VariableDeclarationStatement_RHS() async {
     // SimpleIdentifier  VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo() { }
         class _B { }
@@ -4278,7 +4278,7 @@
   Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
     // VariableDeclaration  VariableDeclarationList
     // VariableDeclarationStatement
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
         lib B;
         foo1() { }
         void bar1() { }
diff --git a/pkg/analysis_server/test/services/correction/organize_directives_test.dart b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
index 0814c80..d70f50a 100644
--- a/pkg/analysis_server/test/services/correction/organize_directives_test.dart
+++ b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
@@ -929,7 +929,7 @@
   const NonLibraryAnnotation();
 }
     ''';
-    addSource(annotationsFile, annotationsContent);
+    newFile(annotationsFile, annotationsContent);
   }
 
   void _assertOrganize(String expectedCode, {bool removeUnused = false}) {
diff --git a/pkg/analysis_server/test/services/refactoring/legacy/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/legacy/abstract_refactoring.dart
index 5302ad1..b8d8d7f 100644
--- a/pkg/analysis_server/test/services/refactoring/legacy/abstract_refactoring.dart
+++ b/pkg/analysis_server/test/services/refactoring/legacy/abstract_refactoring.dart
@@ -139,7 +139,7 @@
   }
 
   Future<void> indexUnit(String file, String code) async {
-    addSource(file, code);
+    newFile(file, code);
   }
 
   @override
diff --git a/pkg/analysis_server/test/services/refactoring/legacy/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/legacy/extract_method_test.dart
index 0629e71..991bfa8 100644
--- a/pkg/analysis_server/test/services/refactoring/legacy/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/legacy/extract_method_test.dart
@@ -3287,7 +3287,7 @@
   }
 
   void _addLibraryReturningAsync() {
-    addSource('$testPackageLibPath/asyncLib.dart', r'''
+    newFile('$testPackageLibPath/asyncLib.dart', r'''
 import 'dart:async';
 
 Completer<int> newCompleter() => null;
diff --git a/pkg/analysis_server/test/services/refactoring/legacy/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/legacy/move_file_test.dart
index 56266c2..4e29bae 100644
--- a/pkg/analysis_server/test/services/refactoring/legacy/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/legacy/move_file_test.dart
@@ -184,7 +184,7 @@
   Future<void> test_file_imported_with_relative_uri_down() async {
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 import 'test.dart';
 ''');
     await analyzeTestPackageFiles();
@@ -204,7 +204,7 @@
     // https://github.com/dart-lang/sdk/issues/45593
     testFile = convertPath('/home/test/bin/aaa.dart');
     var pathB = convertPath('/home/test/bin/bbb.dart');
-    addSource(pathB, '');
+    newFile(pathB, '');
     await resolveTestCode("import 'bbb.dart';");
     await analyzeTestPackageFiles();
 
@@ -218,7 +218,7 @@
   Future<void> test_file_imported_with_relative_uri_sideways() async {
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/sub/folder/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 import 'sub/folder/test.dart';
 ''');
     await analyzeTestPackageFiles();
@@ -235,7 +235,7 @@
   Future<void> test_file_imported_with_relative_uri_up() async {
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/22/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 import '22/test.dart';
 ''');
     await analyzeTestPackageFiles();
@@ -251,7 +251,7 @@
 
   Future<void> test_file_moveOutOfLib() async {
     var binMainPath = convertPath('/home/test/bin/main.dart');
-    addSource(binMainPath, '''
+    newFile(binMainPath, '''
 import 'package:test/test.dart';
 
 void f() {
@@ -281,11 +281,11 @@
     var pathA = convertPath('/home/test/000/1111/a.dart');
     var pathB = convertPath('/home/test/000/b.dart');
     testFile = convertPath('/home/test/000/1111/22/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 library lib;
 part '22/test.dart';
 ''');
-    addSource(pathB, '''
+    newFile(pathB, '''
 library lib;
 part '1111/22/test.dart';
 ''');
@@ -309,7 +309,7 @@
   Future<void> test_file_referenced_by_part() async {
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/22/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 library lib;
 part '22/test.dart';
 ''');
@@ -334,10 +334,10 @@
     final pathC = convertPath('/home/test/lib/old/nested/c.dart');
     final pathD = convertPath('/home/test/lib/old/nested/d.dart');
     testFile = convertPath('/home/test/lib/test.dart');
-    addSource(pathA, '');
-    addSource(pathB, '');
-    addSource(pathC, '');
-    addSource(pathD, '');
+    newFile(pathA, '');
+    newFile(pathB, '');
+    newFile(pathC, '');
+    newFile(pathD, '');
     verifyNoTestUnitErrors = false;
     await resolveTestCode('''
 import 'old/a.dart';
@@ -371,7 +371,7 @@
   Future<void> test_folder_siblingFiles() async {
     testFile = convertPath('/home/test/lib/old/a.dart');
     final pathB = convertPath('/home/test/lib/old/b.dart');
-    addSource(pathB, '');
+    newFile(pathB, '');
     await resolveTestCode('''
 import 'a.dart';
 ''');
@@ -414,7 +414,7 @@
     // path to the parent changes).
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/22/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 library lib;
 part '22/test.dart';
 ''');
@@ -441,7 +441,7 @@
     // path to the parent changes).
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 part of 'test.dart';
 ''');
     await resolveTestCode('''
@@ -464,7 +464,7 @@
     // path to the parent changes).
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 part of 'test.dart';
 ''');
     await resolveTestCode('''
@@ -485,7 +485,7 @@
     // path to the parent changes).
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 part 'test.dart';
 ''');
     addTestSource('''
@@ -510,7 +510,7 @@
     // path to the parent changes).
     var pathA = convertPath('/home/test/000/1111/a.dart');
     testFile = convertPath('/home/test/000/1111/test.dart');
-    addSource(pathA, '''
+    newFile(pathA, '''
 part 'test.dart';
 ''');
     addTestSource('''
diff --git a/pkg/analysis_server/test/services/refactoring/legacy/rename_library_test.dart b/pkg/analysis_server/test/services/refactoring/legacy/rename_library_test.dart
index 0b6b03c..95d825d 100644
--- a/pkg/analysis_server/test/services/refactoring/legacy/rename_library_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/legacy/rename_library_test.dart
@@ -35,7 +35,7 @@
   }
 
   Future<void> test_createChange() async {
-    addSource('$testPackageLibPath/part.dart', '''
+    newFile('$testPackageLibPath/part.dart', '''
 part of my.app;
 ''');
     await indexTestUnit('''
@@ -58,7 +58,7 @@
   }
 
   Future<void> test_createChange_hasWhitespaces() async {
-    addSource('$testPackageLibPath/part.dart', '''
+    newFile('$testPackageLibPath/part.dart', '''
 part of my .  app;
 ''');
     await indexTestUnit('''
diff --git a/pkg/analysis_server/test/src/computer/call_hierarchy_computer_test.dart b/pkg/analysis_server/test/src/computer/call_hierarchy_computer_test.dart
index d24ef91..15448de 100644
--- a/pkg/analysis_server/test/src/computer/call_hierarchy_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/call_hierarchy_computer_test.dart
@@ -174,7 +174,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -221,7 +221,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -298,7 +298,7 @@
 /*1*/void myFunction() {}/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -343,7 +343,7 @@
 /*1*/String get bar => '';/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -372,7 +372,7 @@
 /*1*/class Foo {}/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -457,7 +457,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -506,7 +506,7 @@
 class Foo with Bar {}
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -563,7 +563,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -591,7 +591,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectNoTarget(contents);
   }
 
@@ -627,7 +627,7 @@
 /*1*/set bar(String value) {}/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     await expectTarget(
         contents,
         _isItem(
@@ -702,7 +702,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'Foo');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -766,7 +766,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'myMethod');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -831,7 +831,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'myFunction');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -902,7 +902,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'foo');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -969,7 +969,7 @@
     SourceRange rangeAfter(String prefix, String code) =>
         rangeAfterPrefix(prefix, code, 'Foo');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -1012,7 +1012,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'myMethod');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -1050,7 +1050,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'myMethod');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -1085,7 +1085,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'Bar');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -1124,7 +1124,7 @@
     SourceRange rangeAfter(String prefix) =>
         rangeAfterPrefix(prefix, otherContents, 'foo');
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findIncomingCalls(contents);
     expect(
       calls,
@@ -1197,7 +1197,7 @@
 }/*2*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1241,7 +1241,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1300,7 +1300,7 @@
 /*1*/void f() {}/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1344,7 +1344,7 @@
 }/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1386,7 +1386,7 @@
 class Foo {}
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(calls, isEmpty);
   }
@@ -1416,7 +1416,7 @@
 }/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1464,7 +1464,7 @@
 /*1*/class A with OtherMixin {}/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1510,7 +1510,7 @@
 }
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
@@ -1559,7 +1559,7 @@
 }/*1*/
     ''';
 
-    addSource(otherFile, otherContents);
+    newFile(otherFile, otherContents);
     final calls = await findOutgoingCalls(contents);
     expect(
       calls,
diff --git a/pkg/analysis_server/test/src/domains/execution/completion_test.dart b/pkg/analysis_server/test/src/domains/execution/completion_test.dart
index f6c37f6..fe93eec 100644
--- a/pkg/analysis_server/test/src/domains/execution/completion_test.dart
+++ b/pkg/analysis_server/test/src/domains/execution/completion_test.dart
@@ -26,7 +26,7 @@
 
   void addContextFile(String content) {
     contextFile = convertPath('$testPackageLibPath/context.dart');
-    addSource(contextFile, content);
+    newFile(contextFile, content);
 
     contextOffset = content.indexOf('// context line');
     expect(contextOffset, isNonNegative,
@@ -120,13 +120,13 @@
 
   @FailingTest(reason: 'No support for OverlayResourceProvider')
   Future<void> test_inPart() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 part 'b.dart';
 part 'context.dart';
 
 int a;
 ''');
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 part of 'a.dart';
 
 double b;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
index 0b720f4..a57a14f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
@@ -94,7 +94,7 @@
   }
 
   Future<void> test_declaredIdentifier_addImport_dartUri() async {
-    addSource('$testPackageLibPath/my_lib.dart', r'''
+    newFile('$testPackageLibPath/my_lib.dart', r'''
 import 'dart:collection';
 List<HashMap<String, int>> getMap() => null;
 ''');
@@ -198,7 +198,7 @@
   }
 
   Future<void> test_local_addImport_dartUri() async {
-    addSource('$testPackageLibPath/my_lib.dart', r'''
+    newFile('$testPackageLibPath/my_lib.dart', r'''
 import 'dart:collection';
 HashMap<String, int> getMap() => null;
 ''');
@@ -219,7 +219,7 @@
   }
 
   Future<void> test_local_addImport_notLibraryUnit() async {
-    addSource('$testPackageLibPath/my_lib.dart', r'''
+    newFile('$testPackageLibPath/my_lib.dart', r'''
 import 'dart:collection';
 HashMap<String, int> getMap() => null;
 ''');
@@ -237,7 +237,7 @@
 ''');
 
     var appPath = convertPath('$testPackageLibPath/app.dart');
-    addSource(appPath, appCode);
+    newFile(appPath, appCode);
     await analyzeTestPackageFiles();
     await resolveTestFile();
 
@@ -262,10 +262,10 @@
 
   Future<void> test_local_addImport_relUri() async {
     testFile = convertPath('/home/test/bin/test.dart');
-    addSource('/home/test/bin/aa/bbb/lib_a.dart', r'''
+    newFile('/home/test/bin/aa/bbb/lib_a.dart', r'''
 class MyClass {}
 ''');
-    addSource('/home/test/bin/ccc/lib_b.dart', r'''
+    newFile('/home/test/bin/ccc/lib_b.dart', r'''
 import '../aa/bbb/lib_a.dart';
 MyClass newMyClass() => null;
 ''');
@@ -744,7 +744,7 @@
   }
 
   Future<void> test_privateType_closureParameter() async {
-    addSource('$testPackageLibPath/my_lib.dart', '''
+    newFile('$testPackageLibPath/my_lib.dart', '''
 library my_lib;
 class A {}
 class _B extends A {}
@@ -760,7 +760,7 @@
   }
 
   Future<void> test_privateType_declaredIdentifier() async {
-    addSource('$testPackageLibPath/my_lib.dart', '''
+    newFile('$testPackageLibPath/my_lib.dart', '''
 library my_lib;
 class A {}
 class _B extends A {}
@@ -781,7 +781,7 @@
   Future<void> test_privateType_list() async {
     // This is now failing because we're suggesting "List" rather than nothing.
     // Is it really better to produce nothing?
-    addSource('$testPackageLibPath/my_lib.dart', '''
+    newFile('$testPackageLibPath/my_lib.dart', '''
 library my_lib;
 class A {}
 class _B extends A {}
@@ -819,7 +819,7 @@
   }
 
   Future<void> test_privateType_variable() async {
-    addSource('$testPackageLibPath/my_lib.dart', '''
+    newFile('$testPackageLibPath/my_lib.dart', '''
 library my_lib;
 class A {}
 class _B extends A {}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
index 37f3d66..da0fbeb 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
@@ -20,7 +20,7 @@
   AssistKind get kind => DartAssistKind.CONVERT_PART_OF_TO_URI;
 
   Future<void> test_nonSibling() async {
-    addSource('$testPackageLibPath/foo.dart', '''
+    newFile('$testPackageLibPath/foo.dart', '''
 library foo;
 part 'src/bar.dart';
 ''');
@@ -38,7 +38,7 @@
   }
 
   Future<void> test_sibling() async {
-    addSource('$testPackageLibPath/foo.dart', '''
+    newFile('$testPackageLibPath/foo.dart', '''
 library foo;
 part 'bar.dart';
 ''');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
index 3665770..a002735 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
@@ -21,7 +21,7 @@
   AssistKind get kind => DartAssistKind.CONVERT_TO_PACKAGE_IMPORT;
 
   Future<void> test_fileName_onImport() async {
-    addSource('$testPackageLibPath/foo.dart', '');
+    newFile('$testPackageLibPath/foo.dart', '');
 
     await resolveTestCode('''
 import 'foo.dart';
@@ -33,7 +33,7 @@
   }
 
   Future<void> test_fileName_onUri() async {
-    addSource('$testPackageLibPath/foo.dart', '');
+    newFile('$testPackageLibPath/foo.dart', '');
 
     await resolveTestCode('''
 import 'foo.dart';
@@ -52,7 +52,7 @@
   }
 
   Future<void> test_nonPackage_Uri() async {
-    addSource('$testPackageLibPath/foo.dart', '');
+    newFile('$testPackageLibPath/foo.dart', '');
     testFile = convertPath('$testPackageLibPath/src/test.dart');
     await resolveTestCode('''
 import 'dart:core';
@@ -63,7 +63,7 @@
   }
 
   Future<void> test_packageUri() async {
-    addSource('$testPackageLibPath/foo.dart', '');
+    newFile('$testPackageLibPath/foo.dart', '');
 
     await resolveTestCode('''
 import 'package:test/foo.dart';
@@ -73,7 +73,7 @@
   }
 
   Future<void> test_path() async {
-    addSource('$testPackageLibPath/foo/bar.dart', '');
+    newFile('$testPackageLibPath/foo/bar.dart', '');
 
     testFile = convertPath('$testPackageLibPath/src/test.dart');
 
@@ -89,7 +89,7 @@
   Future<void> test_relativeImport_noAssistWithLint() async {
     createAnalysisOptionsFile(lints: [LintNames.avoid_relative_lib_imports]);
     verifyNoTestUnitErrors = false;
-    addSource('$testPackageLibPath/foo.dart', '');
+    newFile('$testPackageLibPath/foo.dart', '');
 
     await resolveTestCode('''
 import '../lib/foo.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
index 8c1dd75..6b6ceaa 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
@@ -47,7 +47,7 @@
   }
 
   Future<void> test_mixinOnDirective() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 mixin M {}
 ''');
     await resolveTestCode('''
@@ -99,7 +99,7 @@
   }
 
   Future<void> test_setterOnDirective() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 void set setter(int i) {}
 ''');
     await resolveTestCode('''
@@ -119,7 +119,7 @@
   }
 
   Future<void> test_typedefOnDirective() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 typedef Cb = void Function();
 ''');
     await resolveTestCode('''
diff --git a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
index 77754e6..3281946 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
@@ -162,7 +162,7 @@
   }
 
   Future<void> test_privateType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   _B b => _B();
 }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_enum_constant_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_enum_constant_test.dart
index 4fa8591..7441e05 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_enum_constant_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_enum_constant_test.dart
@@ -37,7 +37,7 @@
   }
 
   Future<void> test_differentLibrary() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 enum E {ONE}
 ''');
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
index 6cc2306..cdfbd7d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
@@ -40,7 +40,7 @@
   FixKind get kind => DartFixKind.ADD_LATE;
 
   Future<void> test_changeInImportedLib() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class C {
   final String s;
 }
@@ -60,7 +60,7 @@
   }
 
   Future<void> test_changeInPart() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 part 'test.dart';
 
 class C {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
index 4d5fedb..b140a66 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
@@ -104,7 +104,7 @@
   }
 
   Future<void> test_constructor_single() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {
   A({required int a}) {}
 }
@@ -128,7 +128,7 @@
   }
 
   Future<void> test_constructor_single_closure() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef void VoidCallback();
 
 class A {
@@ -154,7 +154,7 @@
   }
 
   Future<void> test_constructor_single_closure2() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef void Callback(e);
 
 class A {
@@ -180,7 +180,7 @@
   }
 
   Future<void> test_constructor_single_closure3() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef void Callback(a,b,c);
 
 class A {
@@ -206,7 +206,7 @@
   }
 
   Future<void> test_constructor_single_closure4() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef int Callback(int a, String b,c);
 
 class A {
@@ -232,7 +232,7 @@
   }
 
   Future<void> test_constructor_single_closure_nnbd() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef int Callback(int? a);
 
 class A {
@@ -258,7 +258,7 @@
   }
 
   Future<void> test_constructor_single_closure_nnbd_from_legacy() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 // @dart = 2.8
 import 'package:meta/meta.dart';
 
@@ -290,7 +290,7 @@
 
   Future<void> test_constructor_single_closure_nnbd_into_legacy() async {
     noSoundNullSafety = false;
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 typedef int Callback(int? a);
 
 class A {
@@ -318,7 +318,7 @@
   }
 
   Future<void> test_constructor_single_list() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {
   A({required List<String> names}) {}
 }
@@ -342,7 +342,7 @@
   }
 
   Future<void> test_constructor_single_namedAnywhere() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {
   A(int a, int b, {int? c, required int d}) {}
 }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
index 7499207..1d5601c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
@@ -192,7 +192,7 @@
   }
 
   Future<void> test_privateType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   _B b => _B();
 }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
index 12c14cf3..8ef04fe 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
@@ -58,12 +58,12 @@
   }
 
   Future<void> test_method_importType() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {
   static foo() {}
 }
 ''');
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 import 'package:test/a.dart';
 
 class B extends A {}
@@ -142,12 +142,12 @@
   }
 
   Future<void> test_property_importType() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {
   static get foo => null;
 }
 ''');
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 import 'package:test/a.dart';
 
 class B extends A {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
index d461813..c2f0edf 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
@@ -57,7 +57,7 @@
   }
 
   Future<void> test_privateType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   _B b => _B();
 }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
index b952f84..3430002 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
@@ -28,8 +28,8 @@
 
   Future<void> test_singleFile() async {
     writeTestPackageConfig(config: PackageConfigFileBuilder());
-    addSource('$testPackageLibPath/foo.dart', 'class Foo {}');
-    addSource('$testPackageLibPath/bar.dart', 'class Bar {}');
+    newFile('$testPackageLibPath/foo.dart', 'class Foo {}');
+    newFile('$testPackageLibPath/bar.dart', 'class Bar {}');
 
     testFile = convertPath('$testPackageLibPath/test.dart');
 
@@ -86,7 +86,7 @@
   @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44673')
   Future<void> test_singleFile() async {
     writeTestPackageConfig(config: PackageConfigFileBuilder());
-    addSource('$testPackageLibPath/bar.dart', 'class Bar {}');
+    newFile('$testPackageLibPath/bar.dart', 'class Bar {}');
 
     testFile = convertPath('/home/test/tool/test.dart');
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
index dfd5961..98334fe 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
@@ -23,10 +23,10 @@
   String get lintCode => LintNames.prefer_relative_imports;
 
   Future<void> test_singleFile() async {
-    addSource('$testPackageLibPath/foo.dart', '''
+    newFile('$testPackageLibPath/foo.dart', '''
 class C {}
 ''');
-    addSource('$testPackageLibPath/bar.dart', '''
+    newFile('$testPackageLibPath/bar.dart', '''
 class D {}
 ''');
     testFile = convertPath('$testPackageLibPath/src/test.dart');
@@ -55,7 +55,7 @@
   String get lintCode => LintNames.prefer_relative_imports;
 
   Future<void> test_relativeImport() async {
-    addSource('$testPackageLibPath/foo.dart', '''
+    newFile('$testPackageLibPath/foo.dart', '''
 class C {}
 ''');
     testFile = convertPath('$testPackageLibPath/src/test.dart');
@@ -72,7 +72,7 @@
 
   Future<void> test_relativeImportDifferentPackages() async {
     // Validate we don't get a fix with imports referencing different packages.
-    addSource('/home/test1/lib/foo.dart', '');
+    newFile('/home/test1/lib/foo.dart', '');
     testFile = convertPath('/home/test2/lib/bar.dart');
     await resolveTestCode('''
 import 'package:test1/foo.dart';
@@ -82,7 +82,7 @@
   }
 
   Future<void> test_relativeImportGarbledUri() async {
-    addSource('$testPackageLibPath/foo.dart', '');
+    newFile('$testPackageLibPath/foo.dart', '');
     testFile = convertPath('$testPackageLibPath/bar.dart');
     await resolveTestCode('''
 import 'package:test/foo';
@@ -96,7 +96,7 @@
   }
 
   Future<void> test_relativeImportRespectQuoteStyle() async {
-    addSource('$testPackageLibPath/foo.dart', '''
+    newFile('$testPackageLibPath/foo.dart', '''
 class C {}
 ''');
     testFile = convertPath('$testPackageLibPath/bar.dart');
@@ -112,7 +112,7 @@
   }
 
   Future<void> test_relativeImportSameDirectory() async {
-    addSource('$testPackageLibPath/foo.dart', '''
+    newFile('$testPackageLibPath/foo.dart', '''
 class C {}
 ''');
     testFile = convertPath('$testPackageLibPath/bar.dart');
@@ -128,7 +128,7 @@
   }
 
   Future<void> test_relativeImportSubDirectory() async {
-    addSource('$testPackageLibPath/baz/foo.dart', '''
+    newFile('$testPackageLibPath/baz/foo.dart', '''
 class C {}
 ''');
     testFile = convertPath('$testPackageLibPath/test.dart');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
index ad0a3b1..ac1695e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
@@ -73,7 +73,7 @@
   }
 
   Future<void> test_inLibraryOfPrefix() async {
-    addSource('$testPackageLibPath/lib.dart', r'''
+    newFile('$testPackageLibPath/lib.dart', r'''
 class A {}
 ''');
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
index d5a3275..ddd9a34 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
@@ -51,10 +51,10 @@
   }
 
   Future<void> test_importType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {}
 ''');
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 import 'package:test/a.dart';
 
 class B {
@@ -304,10 +304,10 @@
   }
 
   Future<void> test_importType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {}
 ''');
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 import 'package:test/a.dart';
 
 class B {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
index 6f64621..71d082b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
@@ -130,7 +130,7 @@
   }
 
   Future<void> test_getter_qualified_instance_differentLibrary() async {
-    addSource('$testPackageLibPath/other.dart', '''
+    newFile('$testPackageLibPath/other.dart', '''
 /**
  * A comment to push the offset of the braces for the following class
  * declaration past the end of the content of the test file. Used to catch an
@@ -316,11 +316,11 @@
   }
 
   Future<void> test_importType() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {}
 ''');
 
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 import 'package:test/a.dart';
 
 A getA() => null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
index e87134b..1b2f819c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
@@ -259,10 +259,10 @@
   }
 
   Future<void> test_functionType_importType() async {
-    addSource('$testPackageLibPath/a.dart', r'''
+    newFile('$testPackageLibPath/a.dart', r'''
 class A {}
 ''');
-    addSource('$testPackageLibPath/b.dart', r'''
+    newFile('$testPackageLibPath/b.dart', r'''
 import 'package:test/a.dart';
 
 useFunction(int g(A a)) {}
@@ -348,7 +348,7 @@
   }
 
   Future<void> test_importType() async {
-    addSource('$testPackageLibPath/lib.dart', r'''
+    newFile('$testPackageLibPath/lib.dart', r'''
 library lib;
 import 'dart:async';
 Future getFuture() => null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
index ed0884c..25ae477 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
@@ -248,7 +248,7 @@
   }
 
   Future<void> test_qualified_instance_differentLibrary() async {
-    addSource('$testPackageLibPath/other.dart', '''
+    newFile('$testPackageLibPath/other.dart', '''
 /**
  * A comment to push the offset of the braces for the following class
  * declaration past the end of the content of the test file. Used to catch an
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
index 205e45b..de8314c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
@@ -860,8 +860,8 @@
 }
 ''';
 
-    addSource('$testPackageLibPath/test2.dart', code2);
-    addSource('$testPackageLibPath/test3.dart', r'''
+    newFile('$testPackageLibPath/test2.dart', code2);
+    newFile('$testPackageLibPath/test3.dart', r'''
 library test3;
 class E {}
 ''');
@@ -885,7 +885,7 @@
   }
 
   Future<void> test_parameterType_inTargetUnit() async {
-    addSource('$testPackageLibPath/test2.dart', r'''
+    newFile('$testPackageLibPath/test2.dart', r'''
 class D {
 }
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
index eab8bea..8d59d25 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
@@ -35,7 +35,7 @@
     var libCode = r'''
 class A {}
 ''';
-    addSource('$testPackageLibPath/lib.dart', libCode);
+    newFile('$testPackageLibPath/lib.dart', libCode);
     await resolveTestCode('''
 import 'lib.dart' as lib;
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
index 930c68e..1e83a3c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
@@ -244,7 +244,7 @@
   }
 
   Future<void> test_qualified_instance_differentLibrary() async {
-    addSource('$testPackageLibPath/other.dart', '''
+    newFile('$testPackageLibPath/other.dart', '''
 /**
  * A comment to push the offset of the braces for the following class
  * declaration past the end of the content of the test file. Used to catch an
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart
index c7236af..e5b94b5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart
@@ -1173,7 +1173,7 @@
     - kind: 'rename'
       newName: 'New'
 ''');
-    addSource('$testPackageLibPath/test.config', '''
+    newFile('$testPackageLibPath/test.config', '''
 'Rename to New':
   bulkApply: true
 ''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/element_matcher_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/element_matcher_test.dart
index 7ba3316..cfb597a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/element_matcher_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/element_matcher_test.dart
@@ -414,7 +414,7 @@
   }
 
   Future<void> test_imports_relative() async {
-    addSource('$testPackageLibPath/a.dart', '');
+    newFile('$testPackageLibPath/a.dart', '');
     await resolveTestCode('''
 import 'a.dart';
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart
index d045e26..2e5edb1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart
@@ -40,10 +40,10 @@
         ..add(name: 'p1', rootPath: '$workspaceRootPath/p1'),
     );
 
-    addSource('/home/test/pubspec.yaml', '');
+    newFile('/home/test/pubspec.yaml', '');
 
     var testFile = convertPath('$testPackageLibPath/test.dart');
-    addSource(testFile, '');
+    newFile(testFile, '');
     var result = await (await session).getResolvedLibraryValid(testFile);
     var sets = manager.forLibrary(result.element);
     expect(sets, hasLength(2));
@@ -80,10 +80,10 @@
         ..add(name: 'p2', rootPath: '$workspaceRootPath/p2'),
     );
 
-    addSource('/home/test/pubspec.yaml', '');
+    newFile('/home/test/pubspec.yaml', '');
 
     var testFile = convertPath('$testPackageLibPath/test.dart');
-    addSource(testFile, '');
+    newFile(testFile, '');
     var result = await (await session).getResolvedLibraryValid(testFile);
     var sets = manager.forLibrary(result.element);
     expect(sets, hasLength(2));
@@ -92,9 +92,9 @@
   Future<void> test_zeroFiles() async {
     // addTestPackageDependency('p1', '/.pub-cache/p1');
     // addTestPackageDependency('p2', '/.pub-cache/p2');
-    addSource('/home/test/pubspec.yaml', '');
+    newFile('/home/test/pubspec.yaml', '');
     var testFile = convertPath('$testPackageLibPath/test.dart');
-    addSource(testFile, '');
+    newFile(testFile, '');
     var result = await (await session).getResolvedLibraryValid(testFile);
     var sets = manager.forLibrary(result.element);
     expect(sets, hasLength(0));
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
index 3219e6e..ddbe450 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
@@ -33,7 +33,7 @@
   }
 
   Future<void> test_withExtension() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 extension E on int {
   static int foo() => 0;
 }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
index 38beba9..0a3c304 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
@@ -24,7 +24,7 @@
   FixKind get kind => DartFixKind.IMPORT_LIBRARY_PROJECT1;
 
   Future<void> test_alreadyImported_package() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class A {}
 class B {}
 ''');
@@ -40,14 +40,14 @@
   }
 
   Future<void> test_extension_notImported_field_onThisType_fromClass() async {
-    addSource('$testPackageLibPath/lib2.dart', '''
+    newFile('$testPackageLibPath/lib2.dart', '''
 import 'package:test/lib1.dart';
 
 extension E on C {
   int m() => 0;
 }
 ''');
-    addSource('$testPackageLibPath/lib1.dart', '''
+    newFile('$testPackageLibPath/lib1.dart', '''
 class C {}
 ''');
     await resolveTestCode('''
@@ -68,7 +68,7 @@
   }
 
   Future<void> test_extension_notImported_getter() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 extension E on String {
   int get m => 0;
 }
@@ -88,11 +88,11 @@
   }
 
   Future<void> test_extension_notImported_getter_this() async {
-    addSource('$testPackageLibPath/lib1.dart', '''
+    newFile('$testPackageLibPath/lib1.dart', '''
 class A {
 }
 ''');
-    addSource('$testPackageLibPath/lib2.dart', '''
+    newFile('$testPackageLibPath/lib2.dart', '''
 import 'package:test/lib1.dart';
 
 extension E on A {
@@ -121,7 +121,7 @@
   }
 
   Future<void> test_extension_notImported_method() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 extension E on String {
   void m() {}
 }
@@ -141,7 +141,7 @@
   }
 
   Future<void> test_extension_notImported_method_extendsGeneric() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 import 'package:test/lib1.dart';
 
 extension E<T extends num> on List<T> {
@@ -163,14 +163,14 @@
   }
 
   Future<void> test_extension_notImported_method_onThisType_fromClass() async {
-    addSource('$testPackageLibPath/lib2.dart', '''
+    newFile('$testPackageLibPath/lib2.dart', '''
 import 'package:test/lib1.dart';
 
 extension E on C {
   void m() {}
 }
 ''');
-    addSource('$testPackageLibPath/lib1.dart', '''
+    newFile('$testPackageLibPath/lib1.dart', '''
 class C {}
 ''');
     await resolveTestCode('''
@@ -196,14 +196,14 @@
 
   Future<void>
       test_extension_notImported_method_onThisType_fromExtension() async {
-    addSource('$testPackageLibPath/lib2.dart', '''
+    newFile('$testPackageLibPath/lib2.dart', '''
 import 'package:test/lib1.dart';
 
 extension E on C {
   void m() {}
 }
 ''');
-    addSource('$testPackageLibPath/lib1.dart', '''
+    newFile('$testPackageLibPath/lib1.dart', '''
 class C {}
 ''');
     await resolveTestCode('''
@@ -228,7 +228,7 @@
   }
 
   Future<void> test_extension_notImported_operator() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 extension E on String {
   String operator -(String other) => this;
 }
@@ -248,7 +248,7 @@
   }
 
   Future<void> test_extension_notImported_setter() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 extension E on String {
   set m(int v) {}
 }
@@ -306,7 +306,7 @@
   }
 
   Future<void> test_invalidUri_interpolation() async {
-    addSource('$testPackageLibPath/lib.dart', r'''
+    newFile('$testPackageLibPath/lib.dart', r'''
 class Test {
   const Test();
 }
@@ -419,7 +419,7 @@
   }
 
   Future<void> test_notInLib() async {
-    addSource('/home/other/test/lib.dart', '''
+    newFile('/home/other/test/lib.dart', '''
 class Test {}
 ''');
     await resolveTestCode('''
@@ -432,7 +432,7 @@
   }
 
   Future<void> test_relativeDirective() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class Foo {}
 ''');
     await resolveTestCode('''
@@ -454,7 +454,7 @@
   }
 
   Future<void> test_relativeDirective_downOneDirectory() async {
-    addSource('$testPackageLibPath/dir/a.dart', '''
+    newFile('$testPackageLibPath/dir/a.dart', '''
 class Foo {}
 ''');
     await resolveTestCode('''
@@ -471,7 +471,7 @@
 
   Future<void> test_relativeDirective_preferRelativeImports() async {
     createAnalysisOptionsFile(lints: [LintNames.prefer_relative_imports]);
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class Foo {}
 ''');
     await resolveTestCode('''
@@ -493,7 +493,7 @@
   }
 
   Future<void> test_relativeDirective_upOneDirectory() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class Foo {}
 ''');
     testFile = convertPath('$testPackageLibPath/dir/test.dart');
@@ -510,7 +510,7 @@
   }
 
   Future<void> test_withClass_annotation() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 library lib;
 class Test {
   const Test(int p);
@@ -531,7 +531,7 @@
   }
 
   Future<void> test_withClass_catchClause() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class Test {}
 ''');
     await resolveTestCode('''
@@ -557,11 +557,11 @@
   }
 
   Future<void> test_withClass_hasOtherLibraryWithPrefix() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 library a;
 class One {}
 ''');
-    addSource('$testPackageLibPath/b.dart', '''
+    newFile('$testPackageLibPath/b.dart', '''
 library b;
 class One {}
 class Two {}
@@ -585,7 +585,7 @@
 
   Future<void> test_withClass_inParentFolder() async {
     testFile = convertPath('/home/test/bin/aaa/test.dart');
-    addSource('/home/test/bin/lib.dart', '''
+    newFile('/home/test/bin/lib.dart', '''
 library lib;
 class Test {}
 ''');
@@ -607,7 +607,7 @@
 
   Future<void> test_withClass_inRelativeFolder() async {
     testFile = convertPath('/home/test/bin/test.dart');
-    addSource('/home/test/tool/sub/folder/lib.dart', '''
+    newFile('/home/test/tool/sub/folder/lib.dart', '''
 library lib;
 class Test {}
 ''');
@@ -629,7 +629,7 @@
 
   Future<void> test_withClass_inSameFolder() async {
     testFile = convertPath('/home/test/bin/test.dart');
-    addSource('/home/test/bin/lib.dart', '''
+    newFile('/home/test/bin/lib.dart', '''
 library lib;
 class Test {}
 ''');
@@ -650,7 +650,7 @@
   }
 
   Future<void> test_withClass_instanceCreation_const() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class Test {
   const Test();
 }
@@ -670,7 +670,7 @@
   }
 
   Future<void> test_withClass_instanceCreation_const_namedConstructor() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class Test {
   const Test.named();
 }
@@ -690,7 +690,7 @@
   }
 
   Future<void> test_withClass_instanceCreation_implicit() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class Test {
   const Test();
 }
@@ -710,7 +710,7 @@
   }
 
   Future<void> test_withClass_instanceCreation_new() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class Test {
   const Test();
 }
@@ -730,7 +730,7 @@
   }
 
   Future<void> test_withClass_instanceCreation_new_namedConstructor() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class Test {
   Test.named();
 }
@@ -968,7 +968,7 @@
   }
 
   Future<void> test_withFunction() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 library lib;
 myFunction() {}
 ''');
@@ -987,7 +987,7 @@
   }
 
   Future<void> test_withFunction_functionTopLevelVariable() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 var myFunction = () {};
 ''');
     await resolveTestCode('''
@@ -1005,7 +1005,7 @@
   }
 
   Future<void> test_withFunction_functionTopLevelVariableIdentifier() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 var myFunction = () {};
 ''');
     await resolveTestCode('''
@@ -1023,7 +1023,7 @@
   }
 
   Future<void> test_withFunction_identifier() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 library lib;
 myFunction() {}
 ''');
@@ -1043,7 +1043,7 @@
 
   @failingTest
   Future<void> test_withFunction_nonFunctionType() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 int zero = 0;
 ''');
     await resolveTestCode('''
@@ -1055,7 +1055,7 @@
   }
 
   Future<void> test_withFunction_unresolvedMethod() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 library lib;
 myFunction() {}
 ''');
@@ -1078,7 +1078,7 @@
   }
 
   Future<void> test_withFunctionTypeAlias() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 library lib;
 typedef MyFunction();
 ''');
@@ -1099,7 +1099,7 @@
   }
 
   Future<void> test_withGetter_read() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int get foo => 0;
 ''');
 
@@ -1119,7 +1119,7 @@
   }
 
   Future<void> test_withGetter_readWrite() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int get foo => 0;
 ''');
 
@@ -1140,7 +1140,7 @@
 
   /// Not really useful, but shows what we have.
   Future<void> test_withGetter_write() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 int get foo => 0;
 ''');
 
@@ -1160,7 +1160,7 @@
   }
 
   Future<void> test_withMixin() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 mixin Test {}
 ''');
     await resolveTestCode('''
@@ -1174,7 +1174,7 @@
   }
 
   Future<void> test_withSetter_assignment() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 set foo(int _) {}
 ''');
 
@@ -1194,7 +1194,7 @@
   }
 
   Future<void> test_withTopLevelVariable_annotation() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 const foo = 0;
 ''');
 
@@ -1212,7 +1212,7 @@
   }
 
   Future<void> test_withTopLevelVariable_read() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 var foo = 0;
 ''');
 
@@ -1232,7 +1232,7 @@
   }
 
   Future<void> test_withTopLevelVariable_write() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 var foo = 0;
 ''');
 
@@ -1363,7 +1363,7 @@
   FixKind get kind => DartFixKind.IMPORT_LIBRARY_PROJECT3;
 
   Future<void> test_inLibSrc_thisContextRoot_extension() async {
-    addSource('$testPackageLibPath/src/lib.dart', '''
+    newFile('$testPackageLibPath/src/lib.dart', '''
 extension E on int {
   static String m() => '';
 }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
index 6cb0f76..28e9f0a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
@@ -20,7 +20,7 @@
   FixKind get kind => DartFixKind.IMPORT_LIBRARY_SHOW;
 
   Future<void> test_extension_notShown_getter() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class C {}
 extension E on String {
   int get m => 0;
@@ -43,7 +43,7 @@
   }
 
   Future<void> test_extension_notShown_method() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class C {}
 extension E on String {
   void m() {}
@@ -66,7 +66,7 @@
   }
 
   Future<void> test_extension_notShown_operator() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class C {}
 extension E on String {
   String operator -(String other) => this;
@@ -89,7 +89,7 @@
   }
 
   Future<void> test_extension_notShown_setter() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class C {}
 extension E on String {
   set m(int v) {}
@@ -112,7 +112,7 @@
   }
 
   Future<void> test_override_samePackage() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class A {}
 extension E on int {
   String m() => '';
@@ -133,7 +133,7 @@
   }
 
   Future<void> test_package() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class A {}
 class B {}
 ''');
@@ -175,7 +175,7 @@
   }
 
   Future<void> test_static_samePackage() async {
-    addSource('$testPackageLibPath/lib.dart', '''
+    newFile('$testPackageLibPath/lib.dart', '''
 class A {}
 extension E on int {
   static String m() => '';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart
index ac72607..193c962 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart
@@ -172,7 +172,7 @@
   }
 
   Future<void> test_privateType() async {
-    addSource('$testPackageLibPath/a.dart', '''
+    newFile('$testPackageLibPath/a.dart', '''
 class A {
   _B b => _B();
 }