Remove return type from addSource().

Change-Id: Iab4ecce3cdd6f4b4034cb293f56f0c943d069b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169403
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 8d42a9b7..7d5e49a 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -16,7 +16,6 @@
 import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
 import 'package:analyzer/src/dart/analysis/experiments.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine;
-import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/test_utilities/mock_sdk.dart';
 import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
 import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
@@ -79,9 +78,8 @@
 
   String get workspaceRootPath => '/home';
 
-  Source addSource(String path, String content, [Uri uri]) {
-    var file = newFile(path, content: content);
-    return file.createSource(uri);
+  void addSource(String path, String content) {
+    newFile(path, content: content);
   }
 
   Future<void> analyzeTestPackageFiles() async {
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index b0ff7f7..504662a 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -12,7 +12,6 @@
 import 'package:analyzer/src/dart/ast/utilities.dart';
 import 'package:analyzer/src/dart/error/hint_codes.dart';
 import 'package:analyzer/src/generated/java_engine.dart';
-import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/test_utilities/find_node.dart';
 import 'package:analyzer/src/test_utilities/platform.dart';
 import 'package:test/test.dart';
@@ -27,7 +26,6 @@
 
   String testCode;
   String testFile;
-  Source testSource;
   ResolvedUnitResult testAnalysisResult;
   CompilationUnit testUnit;
   CompilationUnitElement testUnitElement;
@@ -35,19 +33,19 @@
   FindNode findNode;
 
   @override
-  Source addSource(String path, String content, [Uri uri]) {
+  void addSource(String path, String content) {
     if (useLineEndingsForPlatform) {
       content = normalizeNewlinesForPlatform(content);
     }
-    return super.addSource(path, content, uri);
+    super.addSource(path, content);
   }
 
-  void addTestSource(String code, [Uri uri]) {
+  void addTestSource(String code) {
     if (useLineEndingsForPlatform) {
       code = normalizeNewlinesForPlatform(code);
     }
     testCode = code;
-    testSource = addSource(testFile, code, uri);
+    addSource(testFile, code);
   }
 
   Element findElement(String name, [ElementKind kind]) {
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 9315f3a..4b8aa22 100644
--- a/pkg/analysis_server/test/services/correction/organize_directives_test.dart
+++ b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
@@ -581,7 +581,7 @@
 
   Future<void> _computeUnitAndErrors(String code) async {
     addTestSource(code);
-    var result = await session.getResolvedUnit(testSource.fullName);
+    var result = await session.getResolvedUnit(testFile);
     testUnit = result.unit;
     testErrors = result.errors;
   }
diff --git a/pkg/analysis_server/test/services/correction/sort_members_test.dart b/pkg/analysis_server/test/services/correction/sort_members_test.dart
index 4c50509..88cc25d 100644
--- a/pkg/analysis_server/test/services/correction/sort_members_test.dart
+++ b/pkg/analysis_server/test/services/correction/sort_members_test.dart
@@ -924,7 +924,7 @@
 
   Future<void> _parseTestUnit(String code) async {
     addTestSource(code);
-    var result = session.getParsedUnit(testSource.fullName);
+    var result = session.getParsedUnit(testFile);
     testUnit = result.unit;
   }
 }
diff --git a/pkg/analysis_server/test/services/refactoring/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
index 5f7b090..fc03973 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -468,7 +468,7 @@
         RefactoringWorkspace([driverFor(testFile)], searchEngine);
     // Allow passing an oldName for when we don't want to rename testSource,
     // but otherwise fall back to testSource.fullname
-    oldFile = convertPath(oldFile ?? testSource.fullName);
+    oldFile = convertPath(oldFile ?? testFile);
     refactoring = MoveFileRefactoring(
         resourceProvider, refactoringWorkspace, testAnalysisResult, oldFile);
     refactoring.newFile = convertPath(newFile);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart b/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart
index cac4641..b6ac127 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/assist_processor.dart
@@ -35,7 +35,7 @@
   }
 
   @override
-  void addTestSource(String code, [Uri uri]) {
+  void addTestSource(String code) {
     if (useLineEndingsForPlatform) {
       code = normalizeNewlinesForPlatform(code);
     }
@@ -61,7 +61,7 @@
         _length = 0;
       }
     }
-    super.addTestSource(code, uri);
+    super.addTestSource(code);
   }
 
   void assertExitPosition({String before, String after}) {
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 98bd8db..3420914 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
@@ -31,8 +31,10 @@
     );
 
     addSource('/home/test/pubspec.yaml', '');
-    var testSource = addSource('/home/test/lib/test.dart', '');
-    var result = await session.getResolvedLibrary(testSource.fullName);
+
+    var testFile = convertPath('/home/test/lib/test.dart');
+    addSource(testFile, '');
+    var result = await session.getResolvedLibrary(testFile);
     var sets = manager.forLibrary(result.element);
     expect(sets, hasLength(2));
   }
@@ -41,8 +43,9 @@
     // addTestPackageDependency('p1', '/.pub-cache/p1');
     // addTestPackageDependency('p2', '/.pub-cache/p2');
     addSource('/home/test/pubspec.yaml', '');
-    var testSource = addSource('/home/test/lib/test.dart', '');
-    var result = await session.getResolvedLibrary(testSource.fullName);
+    var testFile = convertPath('/home/test/lib/test.dart');
+    addSource(testFile, '');
+    var result = await session.getResolvedLibrary(testFile);
     var sets = manager.forLibrary(result.element);
     expect(sets, hasLength(0));
   }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart b/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
index 27092f2..b474c5a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
@@ -29,9 +29,6 @@
 /// A base class defining support for writing fix processor tests that are
 /// specific to fixes associated with lints that use the FixKind.
 abstract class FixProcessorLintTest extends FixProcessorTest {
-  /// The offset of the lint marker in the code being analyzed.
-  int lintOffset = -1;
-
   /// Return the lint code being tested.
   String get lintCode;
 
@@ -45,21 +42,6 @@
   void _createAnalysisOptionsFile() {
     createAnalysisOptionsFile(experiments: experiments, lints: [lintCode]);
   }
-
-  /// Find the error that is to be fixed by computing the errors in the file,
-  /// using the [errorFilter] to filter out errors that should be ignored, and
-  /// expecting that there is a single remaining error. The error filter should
-  /// return `true` if the error should not be ignored.
-  @override
-  Future<AnalysisError> _findErrorToFix(
-      bool Function(AnalysisError) errorFilter,
-      {int length}) async {
-    if (lintOffset < 0) {
-      return super._findErrorToFix(errorFilter, length: 0);
-    }
-    return AnalysisError(
-        testSource, lintOffset, length ?? 0, LintCode(lintCode, '<ignored>'));
-  }
 }
 
 /// A base class defining support for writing fix processor tests.