Convert some tests to use the driver and prepare for others to be converted

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2859993004 .
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 81464a9..34986c1 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -98,19 +98,18 @@
 
   Source addSource(String path, String content, [Uri uri]) {
     File file = newFile(path, content);
+    Source source = file.createSource(uri);
     if (enableNewAnalysisDriver) {
       driver.addFile(path);
       driver.changeFile(path);
       _fileContentOverlay[path] = content;
-      return null;
     } else {
-      Source source = file.createSource(uri);
       ChangeSet changeSet = new ChangeSet();
       changeSet.addedSource(source);
       context.applyChanges(changeSet);
       context.setContents(source, content);
-      return source;
     }
+    return source;
   }
 
   File newFile(String path, [String content]) =>
diff --git a/pkg/analysis_server/test/services/completion/completion_target_test.dart b/pkg/analysis_server/test/services/completion/completion_target_test.dart
index c553188..9e97acc 100644
--- a/pkg/analysis_server/test/services/completion/completion_target_test.dart
+++ b/pkg/analysis_server/test/services/completion/completion_target_test.dart
@@ -4,8 +4,11 @@
 
 library test.services.completion.target;
 
+import 'dart:async';
+
 import 'package:analysis_server/src/provisional/completion/dart/completion_target.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -24,7 +27,10 @@
   int completionOffset;
   CompletionTarget target;
 
-  void addTestSource(String content) {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  Future<Null> addTestSource(String content) async {
     expect(completionOffset, isNull, reason: 'Call addTestSource exactly once');
     completionOffset = content.indexOf('^');
     expect(completionOffset, isNot(equals(-1)), reason: 'missing ^');
@@ -33,12 +39,12 @@
     content = content.substring(0, completionOffset) +
         content.substring(completionOffset + 1);
     testSource = addSource('/test.dart', content);
-    CompilationUnit unit = context.parseCompilationUnit(testSource);
-    target = new CompletionTarget.forOffset(unit, completionOffset);
+    AnalysisResult result = await driver.getResult(testSource.fullName);
+    target = new CompletionTarget.forOffset(result.unit, completionOffset);
   }
 
-  void assertTarget(entityText, nodeText,
-      {int argIndex: null, bool isFunctionalArgument: false}) {
+  Future<Null> assertTarget(entityText, nodeText,
+      {int argIndex: null, bool isFunctionalArgument: false}) async {
     void assertCommon() {
       expect(target.entity.toString(), entityText, reason: 'entity');
       expect(target.containingNode.toString(), nodeText,
@@ -48,543 +54,553 @@
 
     // Assert with parsed unit
     assertCommon();
-    CompilationUnit unit =
-        context.resolveCompilationUnit2(testSource, testSource);
-    target = new CompletionTarget.forOffset(unit, completionOffset);
+    AnalysisResult result = await driver.getResult(testSource.fullName);
+    target = new CompletionTarget.forOffset(result.unit, completionOffset);
     // Assert more with resolved unit
     assertCommon();
     expect(target.isFunctionalArgument(), isFunctionalArgument);
   }
 
-  test_ArgumentList_InstanceCreationExpression() {
+  test_ArgumentList_InstanceCreationExpression() async {
     // ArgumentList  InstanceCreationExpression  Block
-    addTestSource('main() {new Foo(^)}');
-    assertTarget(')', '()', argIndex: 0);
+    await addTestSource('main() {new Foo(^)}');
+    await assertTarget(')', '()', argIndex: 0);
   }
 
-  test_ArgumentList_InstanceCreationExpression2() {
+  test_ArgumentList_InstanceCreationExpression2() async {
     // ArgumentList  InstanceCreationExpression  Block
-    addTestSource('main() {new Foo(a,^)}');
-    assertTarget(')', '(a)', argIndex: 1);
+    await addTestSource('main() {new Foo(a,^)}');
+    await assertTarget(')', '(a)', argIndex: 1);
   }
 
-  test_ArgumentList_InstanceCreationExpression_functionArg2() {
+  test_ArgumentList_InstanceCreationExpression_functionArg2() async {
     // ArgumentList  InstanceCreationExpression  Block
-    addTestSource('main() {new B(^)} class B{B(f()){}}');
-    assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
+    await addTestSource('main() {new B(^)} class B{B(f()){}}');
+    await assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
   }
 
-  test_ArgumentList_InstanceCreationExpression_functionArg3() {
+  test_ArgumentList_InstanceCreationExpression_functionArg3() async {
     // ArgumentList  InstanceCreationExpression  Block
-    addTestSource('main() {new B(1, f: ^)} class B{B(int i, {f()}){}}');
-    assertTarget('', 'f: ', argIndex: 1, isFunctionalArgument: true);
+    await addTestSource('main() {new B(1, f: ^)} class B{B(int i, {f()}){}}');
+    await assertTarget('', 'f: ', argIndex: 1, isFunctionalArgument: true);
   }
 
-  test_ArgumentList_MethodInvocation() {
+  test_ArgumentList_MethodInvocation() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo(^)}');
-    assertTarget(')', '()', argIndex: 0);
+    await addTestSource('main() {foo(^)}');
+    await assertTarget(')', '()', argIndex: 0);
   }
 
-  test_ArgumentList_MethodInvocation2() {
+  test_ArgumentList_MethodInvocation2() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo(^n)}');
-    assertTarget('n', '(n)', argIndex: 0);
+    await addTestSource('main() {foo(^n)}');
+    await assertTarget('n', '(n)', argIndex: 0);
   }
 
-  test_ArgumentList_MethodInvocation3() {
+  test_ArgumentList_MethodInvocation3() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo(n^)}');
-    assertTarget('n', '(n)', argIndex: 0);
+    await addTestSource('main() {foo(n^)}');
+    await assertTarget('n', '(n)', argIndex: 0);
   }
 
-  test_ArgumentList_MethodInvocation3a() {
+  test_ArgumentList_MethodInvocation3a() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo((n)^)}');
-    assertTarget(')', '((n))', argIndex: 0);
+    await addTestSource('main() {foo((n)^)}');
+    await assertTarget(')', '((n))', argIndex: 0);
   }
 
-  test_ArgumentList_MethodInvocation4() {
+  test_ArgumentList_MethodInvocation4() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo(n,^)}');
-    assertTarget(')', '(n)', argIndex: 1);
+    await addTestSource('main() {foo(n,^)}');
+    await assertTarget(')', '(n)', argIndex: 1);
   }
 
-  test_ArgumentList_MethodInvocation_functionArg() {
+  test_ArgumentList_MethodInvocation_functionArg() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo(^)} foo(f()) {}');
-    assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
+    await addTestSource('main() {foo(^)} foo(f()) {}');
+    await assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
   }
 
-  test_ArgumentList_MethodInvocation_functionArg2() {
+  test_ArgumentList_MethodInvocation_functionArg2() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {new B().boo(^)} class B{boo(f()){}}');
-    assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
+    await addTestSource('main() {new B().boo(^)} class B{boo(f()){}}');
+    await assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
   }
 
-  test_ArgumentList_MethodInvocation_functionArg3() {
+  test_ArgumentList_MethodInvocation_functionArg3() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {foo(f: ^)} foo({f()}) {}');
-    assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true);
+    await addTestSource('main() {foo(f: ^)} foo({f()}) {}');
+    await assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true);
   }
 
-  test_ArgumentList_MethodInvocation_functionArg4() {
+  test_ArgumentList_MethodInvocation_functionArg4() async {
     // ArgumentList  MethodInvocation  Block
-    addTestSource('main() {new B().boo(f: ^)} class B{boo({f()}){}}');
-    assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true);
+    await addTestSource('main() {new B().boo(f: ^)} class B{boo({f()}){}}');
+    await assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true);
   }
 
-  test_AsExpression_identifier() {
+  test_AsExpression_identifier() async {
     // SimpleIdentifier  TypeName  AsExpression
-    addTestSource('class A {var b; X _c; foo() {var a; (a^ as String).foo();}');
-    assertTarget('a as String', '(a as String)');
+    await addTestSource(
+        'class A {var b; X _c; foo() {var a; (a^ as String).foo();}');
+    await assertTarget('a as String', '(a as String)');
   }
 
-  test_AsExpression_keyword() {
+  test_AsExpression_keyword() async {
     // SimpleIdentifier  TypeName  AsExpression
-    addTestSource('class A {var b; X _c; foo() {var a; (a ^as String).foo();}');
-    assertTarget('as', 'a as String');
+    await addTestSource(
+        'class A {var b; X _c; foo() {var a; (a ^as String).foo();}');
+    await assertTarget('as', 'a as String');
   }
 
-  test_AsExpression_keyword2() {
+  test_AsExpression_keyword2() async {
     // SimpleIdentifier  TypeName  AsExpression
-    addTestSource('class A {var b; X _c; foo() {var a; (a a^s String).foo();}');
-    assertTarget('as', 'a as String');
+    await addTestSource(
+        'class A {var b; X _c; foo() {var a; (a a^s String).foo();}');
+    await assertTarget('as', 'a as String');
   }
 
-  test_AsExpression_keyword3() {
+  test_AsExpression_keyword3() async {
     // SimpleIdentifier  TypeName  AsExpression
-    addTestSource('class A {var b; X _c; foo() {var a; (a as^ String).foo();}');
-    assertTarget('as', 'a as String');
+    await addTestSource(
+        'class A {var b; X _c; foo() {var a; (a as^ String).foo();}');
+    await assertTarget('as', 'a as String');
   }
 
-  test_AsExpression_type() {
+  test_AsExpression_type() async {
     // SimpleIdentifier  TypeName  AsExpression
-    addTestSource('class A {var b; X _c; foo() {var a; (a as ^String).foo();}');
-    assertTarget('String', 'a as String');
+    await addTestSource(
+        'class A {var b; X _c; foo() {var a; (a as ^String).foo();}');
+    await assertTarget('String', 'a as String');
   }
 
-  test_Block() {
+  test_Block() async {
     // Block
-    addTestSource('main() {^}');
-    assertTarget('}', '{}');
+    await addTestSource('main() {^}');
+    await assertTarget('}', '{}');
   }
 
-  test_Block_keyword() {
-    addTestSource('class C { static C get instance => null; } main() {C.in^}');
-    assertTarget('in', 'C.in');
+  test_Block_keyword() async {
+    await addTestSource(
+        'class C { static C get instance => null; } main() {C.in^}');
+    await assertTarget('in', 'C.in');
   }
 
-  test_Block_keyword2() {
-    addTestSource('class C { static C get instance => null; } main() {C.i^n}');
-    assertTarget('in', 'C.in');
+  test_Block_keyword2() async {
+    await addTestSource(
+        'class C { static C get instance => null; } main() {C.i^n}');
+    await assertTarget('in', 'C.in');
   }
 
-  test_FormalParameter_partialType() {
+  test_FormalParameter_partialType() async {
     // SimpleIdentifier  PrefixedIdentifier  TypeName
-    addTestSource('foo(b.^ f) { }');
-    assertTarget('f', 'b.f');
+    await addTestSource('foo(b.^ f) { }');
+    await assertTarget('f', 'b.f');
   }
 
-  test_FormalParameter_partialType2() {
+  test_FormalParameter_partialType2() async {
     // SimpleIdentifier  PrefixedIdentifier  TypeName
-    addTestSource('foo(b.z^ f) { }');
-    assertTarget('z', 'b.z');
+    await addTestSource('foo(b.z^ f) { }');
+    await assertTarget('z', 'b.z');
   }
 
-  test_FormalParameter_partialType3() {
+  test_FormalParameter_partialType3() async {
     // SimpleIdentifier  PrefixedIdentifier  TypeName
-    addTestSource('foo(b.^) { }');
-    assertTarget('', 'b.');
+    await addTestSource('foo(b.^) { }');
+    await assertTarget('', 'b.');
   }
 
-  test_FormalParameterList() {
+  test_FormalParameterList() async {
     // Token  FormalParameterList  FunctionExpression
-    addTestSource('foo(^) { }');
-    assertTarget(')', '()');
+    await addTestSource('foo(^) { }');
+    await assertTarget(')', '()');
   }
 
-  test_FunctionDeclaration_inLineComment() {
+  test_FunctionDeclaration_inLineComment() async {
     // Comment  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       // normal comment ^
       zoo(z) { } String name;''');
-    assertTarget('// normal comment ', 'zoo(z) {} String name;');
+    await assertTarget('// normal comment ', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_inLineComment2() {
+  test_FunctionDeclaration_inLineComment2() async {
     // Comment  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       // normal ^comment
       zoo(z) { } String name;''');
-    assertTarget('// normal comment', 'zoo(z) {} String name;');
+    await assertTarget('// normal comment', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_inLineComment3() {
+  test_FunctionDeclaration_inLineComment3() async {
     // Comment  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       // normal comment ^
       // normal comment 2
       zoo(z) { } String name;''');
-    assertTarget('// normal comment ', 'zoo(z) {} String name;');
+    await assertTarget('// normal comment ', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_inLineComment4() {
+  test_FunctionDeclaration_inLineComment4() async {
     // Comment  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       // normal comment
       // normal comment 2^
       zoo(z) { } String name;''');
-    assertTarget('// normal comment 2', 'zoo(z) {} String name;');
+    await assertTarget('// normal comment 2', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_inLineDocComment() {
+  test_FunctionDeclaration_inLineDocComment() async {
     // Comment  FunctionDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       /// some dartdoc ^
       zoo(z) { } String name;''');
-    assertTarget('/// some dartdoc ', '');
+    await assertTarget('/// some dartdoc ', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_inLineDocComment2() {
+  test_FunctionDeclaration_inLineDocComment2() async {
     // Comment  FunctionDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       /// some ^dartdoc
       zoo(z) { } String name;''');
-    assertTarget('/// some dartdoc', '');
+    await assertTarget('/// some dartdoc', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_inStarComment() {
+  test_FunctionDeclaration_inStarComment() async {
     // Comment  CompilationUnit
-    addTestSource('/* ^ */ zoo(z) {} String name;');
-    assertTarget('/*  */', 'zoo(z) {} String name;');
+    await addTestSource('/* ^ */ zoo(z) {} String name;');
+    await assertTarget('/*  */', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_inStarComment2() {
+  test_FunctionDeclaration_inStarComment2() async {
     // Comment  CompilationUnit
-    addTestSource('/*  *^/ zoo(z) {} String name;');
-    assertTarget('/*  */', 'zoo(z) {} String name;');
+    await addTestSource('/*  *^/ zoo(z) {} String name;');
+    await assertTarget('/*  */', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_inStarDocComment() {
+  test_FunctionDeclaration_inStarDocComment() async {
     // Comment  FunctionDeclaration  CompilationUnit
-    addTestSource('/** ^ */ zoo(z) { } String name;');
-    assertTarget('/**  */', '');
+    await addTestSource('/** ^ */ zoo(z) { } String name;');
+    await assertTarget('/**  */', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_inStarDocComment2() {
+  test_FunctionDeclaration_inStarDocComment2() async {
     // Comment  FunctionDeclaration  CompilationUnit
-    addTestSource('/**  *^/ zoo(z) { } String name;');
-    assertTarget('/**  */', '');
+    await addTestSource('/**  *^/ zoo(z) { } String name;');
+    await assertTarget('/**  */', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_returnType() {
+  test_FunctionDeclaration_returnType() async {
     // CompilationUnit
-    addTestSource('^ zoo(z) { } String name;');
-    assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+    await addTestSource('^ zoo(z) { } String name;');
+    await assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_returnType_afterLineComment() {
+  test_FunctionDeclaration_returnType_afterLineComment() async {
     // FunctionDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       // normal comment
       ^ zoo(z) {} String name;''');
-    assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+    await assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_returnType_afterLineComment2() {
+  test_FunctionDeclaration_returnType_afterLineComment2() async {
     // FunctionDeclaration  CompilationUnit
     // TOD(danrubel) left align all test source
-    addTestSource('''
+    await addTestSource('''
 // normal comment
 ^ zoo(z) {} String name;''');
-    assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+    await assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_returnType_afterLineDocComment() {
+  test_FunctionDeclaration_returnType_afterLineDocComment() async {
     // SimpleIdentifier  FunctionDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       /// some dartdoc
       ^ zoo(z) { } String name; ''');
-    assertTarget('zoo', 'zoo(z) {}');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_returnType_afterLineDocComment2() {
+  test_FunctionDeclaration_returnType_afterLineDocComment2() async {
     // SimpleIdentifier  FunctionDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
 /// some dartdoc
 ^ zoo(z) { } String name;''');
-    assertTarget('zoo', 'zoo(z) {}');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_returnType_afterStarComment() {
+  test_FunctionDeclaration_returnType_afterStarComment() async {
     // CompilationUnit
-    addTestSource('/* */ ^ zoo(z) { } String name;');
-    assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+    await addTestSource('/* */ ^ zoo(z) { } String name;');
+    await assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_returnType_afterStarComment2() {
+  test_FunctionDeclaration_returnType_afterStarComment2() async {
     // CompilationUnit
-    addTestSource('/* */^ zoo(z) { } String name;');
-    assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
+    await addTestSource('/* */^ zoo(z) { } String name;');
+    await assertTarget('zoo(z) {}', 'zoo(z) {} String name;');
   }
 
-  test_FunctionDeclaration_returnType_afterStarDocComment() {
+  test_FunctionDeclaration_returnType_afterStarDocComment() async {
     // FunctionDeclaration  CompilationUnit
-    addTestSource('/** */ ^ zoo(z) { } String name;');
-    assertTarget('zoo', 'zoo(z) {}');
+    await addTestSource('/** */ ^ zoo(z) { } String name;');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_FunctionDeclaration_returnType_afterStarDocComment2() {
+  test_FunctionDeclaration_returnType_afterStarDocComment2() async {
     // FunctionDeclaration  CompilationUnit
-    addTestSource('/** */^ zoo(z) { } String name;');
-    assertTarget('zoo', 'zoo(z) {}');
+    await addTestSource('/** */^ zoo(z) { } String name;');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_InstanceCreationExpression_identifier() {
+  test_InstanceCreationExpression_identifier() async {
     // InstanceCreationExpression  ExpressionStatement  Block
-    addTestSource('class C {foo(){var f; {var x;} new ^C();}}');
-    assertTarget('C', 'new C()');
+    await addTestSource('class C {foo(){var f; {var x;} new ^C();}}');
+    await assertTarget('C', 'new C()');
   }
 
-  test_InstanceCreationExpression_keyword() {
+  test_InstanceCreationExpression_keyword() async {
     // InstanceCreationExpression  ExpressionStatement  Block
-    addTestSource('class C {foo(){var f; {var x;} new^ }}');
-    assertTarget('new ();', '{var f; {var x;} new ();}');
+    await addTestSource('class C {foo(){var f; {var x;} new^ }}');
+    await assertTarget('new ();', '{var f; {var x;} new ();}');
   }
 
-  test_InstanceCreationExpression_keyword2() {
+  test_InstanceCreationExpression_keyword2() async {
     // InstanceCreationExpression  ExpressionStatement  Block
-    addTestSource('class C {foo(){var f; {var x;} new^ C();}}');
-    assertTarget('new C();', '{var f; {var x;} new C();}');
+    await addTestSource('class C {foo(){var f; {var x;} new^ C();}}');
+    await assertTarget('new C();', '{var f; {var x;} new C();}');
   }
 
-  test_MapLiteralEntry() {
+  test_MapLiteralEntry() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addTestSource('foo = {^');
-    assertTarget(' : ', '{ : }');
+    await addTestSource('foo = {^');
+    await assertTarget(' : ', '{ : }');
   }
 
-  test_MapLiteralEntry1() {
+  test_MapLiteralEntry1() async {
     // MapLiteralEntry  MapLiteral  VariableDeclaration
-    addTestSource('foo = {T^');
-    assertTarget('T : ', '{T : }');
+    await addTestSource('foo = {T^');
+    await assertTarget('T : ', '{T : }');
   }
 
-  test_MapLiteralEntry2() {
+  test_MapLiteralEntry2() async {
     // SimpleIdentifier  MapLiteralEntry  MapLiteral  VariableDeclaration
-    addTestSource('foo = {7:T^};');
-    assertTarget('T', '7 : T');
+    await addTestSource('foo = {7:T^};');
+    await assertTarget('T', '7 : T');
   }
 
-  test_MethodDeclaration_inLineComment() {
+  test_MethodDeclaration_inLineComment() async {
     // Comment  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         // normal comment ^
         zoo(z) { } String name; }''');
-    assertTarget('// normal comment ', 'class C2 {zoo(z) {} String name;}');
+    await assertTarget(
+        '// normal comment ', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_inLineComment2() {
+  test_MethodDeclaration_inLineComment2() async {
     // Comment  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         // normal ^comment
         zoo(z) { } String name; }''');
-    assertTarget('// normal comment', 'class C2 {zoo(z) {} String name;}');
+    await assertTarget(
+        '// normal comment', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_inLineComment3() {
+  test_MethodDeclaration_inLineComment3() async {
     // Comment  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         // normal comment ^
         // normal comment 2
         zoo(z) { } String name; }''');
-    assertTarget('// normal comment ', 'class C2 {zoo(z) {} String name;}');
+    await assertTarget(
+        '// normal comment ', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_inLineComment4() {
+  test_MethodDeclaration_inLineComment4() async {
     // Comment  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         // normal comment
         // normal comment 2^
         zoo(z) { } String name; }''');
-    assertTarget('// normal comment 2', 'class C2 {zoo(z) {} String name;}');
+    await assertTarget(
+        '// normal comment 2', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_inLineDocComment() {
+  test_MethodDeclaration_inLineDocComment() async {
     // Comment  MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         /// some dartdoc ^
         zoo(z) { } String name; }''');
-    assertTarget('/// some dartdoc ', '');
+    await assertTarget('/// some dartdoc ', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_inLineDocComment2() {
+  test_MethodDeclaration_inLineDocComment2() async {
     // Comment  MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         /// some ^dartdoc
         zoo(z) { } String name; }''');
-    assertTarget('/// some dartdoc', '');
+    await assertTarget('/// some dartdoc', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_inStarComment() {
+  test_MethodDeclaration_inStarComment() async {
     // Comment  ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/* ^ */ zoo(z) {} String name;}');
-    assertTarget('/*  */', 'class C2 {zoo(z) {} String name;}');
+    await addTestSource('class C2 {/* ^ */ zoo(z) {} String name;}');
+    await assertTarget('/*  */', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_inStarComment2() {
+  test_MethodDeclaration_inStarComment2() async {
     // Comment  ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/*  *^/ zoo(z) {} String name;}');
-    assertTarget('/*  */', 'class C2 {zoo(z) {} String name;}');
+    await addTestSource('class C2 {/*  *^/ zoo(z) {} String name;}');
+    await assertTarget('/*  */', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_inStarDocComment() {
+  test_MethodDeclaration_inStarDocComment() async {
     // Comment  MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/** ^ */ zoo(z) { } String name; }');
-    assertTarget('/**  */', '');
+    await addTestSource('class C2 {/** ^ */ zoo(z) { } String name; }');
+    await assertTarget('/**  */', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_inStarDocComment2() {
+  test_MethodDeclaration_inStarDocComment2() async {
     // Comment  MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/**  *^/ zoo(z) { } String name; }');
-    assertTarget('/**  */', '');
+    await addTestSource('class C2 {/**  *^/ zoo(z) { } String name; }');
+    await assertTarget('/**  */', '');
     expect(target.containingNode is Comment, isTrue);
     expect(target.containingNode.parent.toSource(), 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_returnType() {
+  test_MethodDeclaration_returnType() async {
     // ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {^ zoo(z) { } String name; }');
-    assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
+    await addTestSource('class C2 {^ zoo(z) { } String name; }');
+    await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_returnType_afterLineComment() {
+  test_MethodDeclaration_returnType_afterLineComment() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         // normal comment
         ^ zoo(z) {} String name;}''');
-    assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
+    await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_returnType_afterLineComment2() {
+  test_MethodDeclaration_returnType_afterLineComment2() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
     // TOD(danrubel) left align all test source
-    addTestSource('''
+    await addTestSource('''
 class C2 {
   // normal comment
 ^ zoo(z) {} String name;}''');
-    assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
+    await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_returnType_afterLineDocComment() {
+  test_MethodDeclaration_returnType_afterLineDocComment() async {
     // SimpleIdentifier  MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
       class C2 {
         /// some dartdoc
         ^ zoo(z) { } String name; }''');
-    assertTarget('zoo', 'zoo(z) {}');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_returnType_afterLineDocComment2() {
+  test_MethodDeclaration_returnType_afterLineDocComment2() async {
     // SimpleIdentifier  MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('''
+    await addTestSource('''
 class C2 {
   /// some dartdoc
 ^ zoo(z) { } String name; }''');
-    assertTarget('zoo', 'zoo(z) {}');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_returnType_afterStarComment() {
+  test_MethodDeclaration_returnType_afterStarComment() async {
     // ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/* */ ^ zoo(z) { } String name; }');
-    assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
+    await addTestSource('class C2 {/* */ ^ zoo(z) { } String name; }');
+    await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_returnType_afterStarComment2() {
+  test_MethodDeclaration_returnType_afterStarComment2() async {
     // ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/* */^ zoo(z) { } String name; }');
-    assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
+    await addTestSource('class C2 {/* */^ zoo(z) { } String name; }');
+    await assertTarget('zoo(z) {}', 'class C2 {zoo(z) {} String name;}');
   }
 
-  test_MethodDeclaration_returnType_afterStarDocComment() {
+  test_MethodDeclaration_returnType_afterStarDocComment() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/** */ ^ zoo(z) { } String name; }');
-    assertTarget('zoo', 'zoo(z) {}');
+    await addTestSource('class C2 {/** */ ^ zoo(z) { } String name; }');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_MethodDeclaration_returnType_afterStarDocComment2() {
+  test_MethodDeclaration_returnType_afterStarDocComment2() async {
     // MethodDeclaration  ClassDeclaration  CompilationUnit
-    addTestSource('class C2 {/** */^ zoo(z) { } String name; }');
-    assertTarget('zoo', 'zoo(z) {}');
+    await addTestSource('class C2 {/** */^ zoo(z) { } String name; }');
+    await assertTarget('zoo', 'zoo(z) {}');
   }
 
-  test_SwitchStatement_c() {
+  test_SwitchStatement_c() async {
     // Token('c') SwitchStatement
-    addTestSource('main() { switch(x) {c^} }');
-    assertTarget('}', 'switch (x) {}');
+    await addTestSource('main() { switch(x) {c^} }');
+    await assertTarget('}', 'switch (x) {}');
   }
 
-  test_SwitchStatement_c2() {
+  test_SwitchStatement_c2() async {
     // Token('c') SwitchStatement
-    addTestSource('main() { switch(x) { c^ } }');
-    assertTarget('}', 'switch (x) {}');
+    await addTestSource('main() { switch(x) { c^ } }');
+    await assertTarget('}', 'switch (x) {}');
   }
 
-  test_SwitchStatement_empty() {
+  test_SwitchStatement_empty() async {
     // SwitchStatement
-    addTestSource('main() { switch(x) {^} }');
-    assertTarget('}', 'switch (x) {}');
+    await addTestSource('main() { switch(x) {^} }');
+    await assertTarget('}', 'switch (x) {}');
   }
 
-  test_SwitchStatement_empty2() {
+  test_SwitchStatement_empty2() async {
     // SwitchStatement
-    addTestSource('main() { switch(x) { ^ } }');
-    assertTarget('}', 'switch (x) {}');
+    await addTestSource('main() { switch(x) { ^ } }');
+    await assertTarget('}', 'switch (x) {}');
   }
 
-  test_TypeArgumentList() {
+  test_TypeArgumentList() async {
     // TypeName  TypeArgumentList  TypeName
-    addTestSource('main() { C<^> c; }');
-    assertTarget('', '<>');
+    await addTestSource('main() { C<^> c; }');
+    await assertTarget('', '<>');
   }
 
-  test_TypeArgumentList2() {
+  test_TypeArgumentList2() async {
     // TypeName  TypeArgumentList  TypeName
-    addTestSource('main() { C<C^> c; }');
-    assertTarget('C', '<C>');
+    await addTestSource('main() { C<C^> c; }');
+    await assertTarget('C', '<C>');
   }
 
-  test_VariableDeclaration_lhs_identifier_after() {
+  test_VariableDeclaration_lhs_identifier_after() async {
     // VariableDeclaration  VariableDeclarationList
-    addTestSource('main() {int b^ = 1;}');
-    assertTarget('b = 1', 'int b = 1');
+    await addTestSource('main() {int b^ = 1;}');
+    await assertTarget('b = 1', 'int b = 1');
   }
 
-  test_VariableDeclaration_lhs_identifier_before() {
+  test_VariableDeclaration_lhs_identifier_before() async {
     // VariableDeclaration  VariableDeclarationList
-    addTestSource('main() {int ^b = 1;}');
-    assertTarget('b = 1', 'int b = 1');
+    await addTestSource('main() {int ^b = 1;}');
+    await assertTarget('b = 1', 'int b = 1');
   }
 }
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 96fc16e..26f9fe1 100644
--- a/pkg/analysis_server/test/services/correction/organize_directives_test.dart
+++ b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
@@ -2,10 +2,13 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:async';
+
 import 'package:analysis_server/protocol/protocol_generated.dart'
     hide AnalysisError;
 import 'package:analysis_server/src/services/correction/organize_directives.dart';
 import 'package:analyzer/error/error.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -21,8 +24,11 @@
 class OrganizeDirectivesTest extends AbstractSingleUnitTest {
   List<AnalysisError> testErrors;
 
-  void test_keep_duplicateImports_withDifferentPrefix() {
-    _computeUnitAndErrors(r'''
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  test_keep_duplicateImports_withDifferentPrefix() async {
+    await _computeUnitAndErrors(r'''
 import 'dart:async' as async1;
 import 'dart:async' as async2;
 
@@ -44,8 +50,8 @@
         removeUnused: true);
   }
 
-  void test_remove_duplicateImports() {
-    _computeUnitAndErrors(r'''
+  test_remove_duplicateImports() async {
+    await _computeUnitAndErrors(r'''
 import 'dart:async';
 import 'dart:async';
 
@@ -64,8 +70,8 @@
         removeUnused: true);
   }
 
-  void test_remove_duplicateImports_differentText_uri() {
-    _computeUnitAndErrors(r'''
+  test_remove_duplicateImports_differentText_uri() async {
+    await _computeUnitAndErrors(r'''
 import 'dart:async' as async;
 import "dart:async" as async;
 
@@ -84,8 +90,8 @@
         removeUnused: true);
   }
 
-  void test_remove_duplicateImports_withSamePrefix() {
-    _computeUnitAndErrors(r'''
+  test_remove_duplicateImports_withSamePrefix() async {
+    await _computeUnitAndErrors(r'''
 import 'dart:async' as async;
 import 'dart:async' as async;
 
@@ -104,10 +110,10 @@
         removeUnused: true);
   }
 
-  void test_remove_unresolvedDirectives() {
+  test_remove_unresolvedDirectives() async {
     addSource('/existing_part1.dart', 'part of lib;');
     addSource('/existing_part2.dart', 'part of lib;');
-    _computeUnitAndErrors(r'''
+    await _computeUnitAndErrors(r'''
 library lib;
 
 import 'dart:async';
@@ -147,8 +153,8 @@
         removeUnresolved: true);
   }
 
-  void test_remove_unusedImports() {
-    _computeUnitAndErrors(r'''
+  test_remove_unusedImports() async {
+    await _computeUnitAndErrors(r'''
 library lib;
 
 import 'dart:async';
@@ -177,8 +183,8 @@
         removeUnused: true);
   }
 
-  void test_remove_unusedImports2() {
-    _computeUnitAndErrors(r'''
+  test_remove_unusedImports2() async {
+    await _computeUnitAndErrors(r'''
 import 'dart:async';
 import 'dart:math';
 
@@ -201,8 +207,8 @@
         removeUnused: true);
   }
 
-  void test_sort() {
-    _computeUnitAndErrors(r'''
+  test_sort() async {
+    await _computeUnitAndErrors(r'''
 library lib;
 
 export 'dart:bbb';
@@ -263,8 +269,8 @@
 ''');
   }
 
-  void test_sort_hasComments() {
-    _computeUnitAndErrors(r'''
+  test_sort_hasComments() async {
+    await _computeUnitAndErrors(r'''
 // header
 library lib;
 
@@ -294,8 +300,8 @@
 ''');
   }
 
-  void test_sort_imports_packageAndPath() {
-    _computeUnitAndErrors(r'''
+  test_sort_imports_packageAndPath() async {
+    await _computeUnitAndErrors(r'''
 library lib;
 
 import 'package:product.ui.api.bbb/manager1.dart';
@@ -328,9 +334,10 @@
     expect(result, expectedCode);
   }
 
-  void _computeUnitAndErrors(String code) {
+  Future<Null> _computeUnitAndErrors(String code) async {
     addTestSource(code);
-    testUnit = context.resolveCompilationUnit2(testSource, testSource);
-    testErrors = context.computeErrors(testSource);
+    AnalysisResult result = await driver.getResult(testSource.fullName);
+    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 1604bca..0d272e0 100644
--- a/pkg/analysis_server/test/services/correction/sort_members_test.dart
+++ b/pkg/analysis_server/test/services/correction/sort_members_test.dart
@@ -2,8 +2,11 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:async';
+
 import 'package:analysis_server/protocol/protocol_generated.dart';
 import 'package:analysis_server/src/services/correction/sort_members.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -17,8 +20,11 @@
 
 @reflectiveTest
 class SortMembersTest extends AbstractSingleUnitTest {
-  void test_classMembers_accessor() {
-    _parseTestUnit(r'''
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  test_classMembers_accessor() async {
+    await _parseTestUnit(r'''
 class A {
   set c(x) {}
   set a(x) {}
@@ -41,8 +47,8 @@
 ''');
   }
 
-  void test_classMembers_accessor_static() {
-    _parseTestUnit(r'''
+  test_classMembers_accessor_static() async {
+    await _parseTestUnit(r'''
 class A {
   get a => null;
   set a(x) {}
@@ -61,8 +67,8 @@
 ''');
   }
 
-  void test_classMembers_constructor() {
-    _parseTestUnit(r'''
+  test_classMembers_constructor() async {
+    await _parseTestUnit(r'''
 class A {
   A.c() {   }
   A.a() { }
@@ -81,8 +87,8 @@
 ''');
   }
 
-  void test_classMembers_external_constructorMethod() {
-    _parseTestUnit(r'''
+  test_classMembers_external_constructorMethod() async {
+    await _parseTestUnit(r'''
 class Chart {
   external Pie();
   external Chart();
@@ -97,8 +103,8 @@
 ''');
   }
 
-  void test_classMembers_field() {
-    _parseTestUnit(r'''
+  test_classMembers_field() async {
+    await _parseTestUnit(r'''
 class A {
   String c;
   int a;
@@ -117,8 +123,8 @@
 ''');
   }
 
-  void test_classMembers_field_static() {
-    _parseTestUnit(r'''
+  test_classMembers_field_static() async {
+    await _parseTestUnit(r'''
 class A {
   int b;
   int a;
@@ -137,8 +143,8 @@
 ''');
   }
 
-  void test_classMembers_method() {
-    _parseTestUnit(r'''
+  test_classMembers_method() async {
+    await _parseTestUnit(r'''
 class A {
   c() {}
   a() {}
@@ -155,8 +161,8 @@
 ''');
   }
 
-  void test_classMembers_method_emptyLine() {
-    _parseTestUnit(r'''
+  test_classMembers_method_emptyLine() async {
+    await _parseTestUnit(r'''
 class A {
   b() {}
 
@@ -173,8 +179,8 @@
 ''');
   }
 
-  void test_classMembers_method_ignoreCase() {
-    _parseTestUnit(r'''
+  test_classMembers_method_ignoreCase() async {
+    await _parseTestUnit(r'''
 class A {
   m_C() {}
   m_a() {}
@@ -191,8 +197,8 @@
 ''');
   }
 
-  void test_classMembers_method_static() {
-    _parseTestUnit(r'''
+  test_classMembers_method_static() async {
+    await _parseTestUnit(r'''
 class A {
   static a() {}
   b() {}
@@ -207,8 +213,8 @@
 ''');
   }
 
-  void test_classMembers_mix() {
-    _parseTestUnit(r'''
+  test_classMembers_mix() async {
+    await _parseTestUnit(r'''
 class A {
   /// static field public
   static int nnn;
@@ -307,8 +313,8 @@
 ''');
   }
 
-  void test_directives() {
-    _parseTestUnit(r'''
+  test_directives() async {
+    await _parseTestUnit(r'''
 library lib;
 
 export 'dart:bbb';
@@ -369,8 +375,8 @@
 ''');
   }
 
-  void test_directives_docComment_hasLibrary_lines() {
-    _parseTestUnit(r'''
+  test_directives_docComment_hasLibrary_lines() async {
+    await _parseTestUnit(r'''
 /// Library documentation comment A.
 /// Library documentation comment B.
 library foo.bar;
@@ -399,8 +405,8 @@
 ''');
   }
 
-  void test_directives_docComment_hasLibrary_stars() {
-    _parseTestUnit(r'''
+  test_directives_docComment_hasLibrary_stars() async {
+    await _parseTestUnit(r'''
 /**
  * Library documentation comment A.
  * Library documentation comment B.
@@ -437,8 +443,8 @@
 ''');
   }
 
-  void test_directives_docComment_noLibrary_lines() {
-    _parseTestUnit(r'''
+  test_directives_docComment_noLibrary_lines() async {
+    await _parseTestUnit(r'''
 /// Library documentation comment A
 /// Library documentation comment B
 import 'b.dart';
@@ -457,8 +463,8 @@
 ''');
   }
 
-  void test_directives_docComment_noLibrary_stars() {
-    _parseTestUnit(r'''
+  test_directives_docComment_noLibrary_stars() async {
+    await _parseTestUnit(r'''
 /**
  * Library documentation comment A.
  * Library documentation comment B.
@@ -485,8 +491,8 @@
 ''');
   }
 
-  void test_directives_imports_packageAndPath() {
-    _parseTestUnit(r'''
+  test_directives_imports_packageAndPath() async {
+    await _parseTestUnit(r'''
 library lib;
 
 import 'package:product.ui.api.bbb/manager1.dart';
@@ -509,8 +515,8 @@
 ''');
   }
 
-  void test_unitMembers_class() {
-    _parseTestUnit(r'''
+  test_unitMembers_class() async {
+    await _parseTestUnit(r'''
 class C {}
 class A {}
 class B {}
@@ -523,8 +529,8 @@
 ''');
   }
 
-  void test_unitMembers_class_ignoreCase() {
-    _parseTestUnit(r'''
+  test_unitMembers_class_ignoreCase() async {
+    await _parseTestUnit(r'''
 class C {}
 class a {}
 class B {}
@@ -537,8 +543,8 @@
 ''');
   }
 
-  void test_unitMembers_classTypeAlias() {
-    _parseTestUnit(r'''
+  test_unitMembers_classTypeAlias() async {
+    await _parseTestUnit(r'''
 class M {}
 class C = Object with M;
 class A = Object with M;
@@ -553,8 +559,8 @@
 ''');
   }
 
-  void test_unitMembers_directive_hasDirective() {
-    _parseTestUnit(r'''
+  test_unitMembers_directive_hasDirective() async {
+    await _parseTestUnit(r'''
 library lib;
 class C {}
 class A {}
@@ -569,8 +575,8 @@
 ''');
   }
 
-  void test_unitMembers_directive_noDirective_hasComment_line() {
-    _parseTestUnit(r'''
+  test_unitMembers_directive_noDirective_hasComment_line() async {
+    await _parseTestUnit(r'''
 // Some comment
 
 class B {}
@@ -587,8 +593,8 @@
 ''');
   }
 
-  void test_unitMembers_directive_noDirective_noComment() {
-    _parseTestUnit(r'''
+  test_unitMembers_directive_noDirective_noComment() async {
+    await _parseTestUnit(r'''
 
 class B {}
 
@@ -603,8 +609,8 @@
 ''');
   }
 
-  void test_unitMembers_enum() {
-    _parseTestUnit(r'''
+  test_unitMembers_enum() async {
+    await _parseTestUnit(r'''
 enum C {x, y}
 enum A {x, y}
 enum B {x, y}
@@ -617,8 +623,8 @@
 ''');
   }
 
-  void test_unitMembers_enumClass() {
-    _parseTestUnit(r'''
+  test_unitMembers_enumClass() async {
+    await _parseTestUnit(r'''
 enum C {x, y}
 class A {}
 class D {}
@@ -633,8 +639,8 @@
 ''');
   }
 
-  void test_unitMembers_function() {
-    _parseTestUnit(r'''
+  test_unitMembers_function() async {
+    await _parseTestUnit(r'''
 fc() {}
 fa() {}
 fb() {}
@@ -647,8 +653,8 @@
 ''');
   }
 
-  void test_unitMembers_functionTypeAlias() {
-    _parseTestUnit(r'''
+  test_unitMembers_functionTypeAlias() async {
+    await _parseTestUnit(r'''
 typedef FC();
 typedef FA();
 typedef FB();
@@ -661,8 +667,8 @@
 ''');
   }
 
-  void test_unitMembers_importsAndDeclarations() {
-    _parseTestUnit(r'''
+  test_unitMembers_importsAndDeclarations() async {
+    await _parseTestUnit(r'''
 import 'dart:a';
 import 'package:b';
 
@@ -684,8 +690,8 @@
 ''');
   }
 
-  void test_unitMembers_mainFirst() {
-    _parseTestUnit(r'''
+  test_unitMembers_mainFirst() async {
+    await _parseTestUnit(r'''
 class C {}
 aaa() {}
 get bbb() {}
@@ -704,8 +710,8 @@
 ''');
   }
 
-  void test_unitMembers_mix() {
-    _parseTestUnit(r'''
+  test_unitMembers_mix() async {
+    await _parseTestUnit(r'''
 _mmm() {}
 typedef nnn();
 _nnn() {}
@@ -760,8 +766,8 @@
 ''');
   }
 
-  void test_unitMembers_topLevelVariable() {
-    _parseTestUnit(r'''
+  test_unitMembers_topLevelVariable() async {
+    await _parseTestUnit(r'''
 int c;
 int a;
 int b;
@@ -774,8 +780,8 @@
 ''');
   }
 
-  void test_unitMembers_topLevelVariable_withConst() {
-    _parseTestUnit(r'''
+  test_unitMembers_topLevelVariable_withConst() async {
+    await _parseTestUnit(r'''
 int c;
 int a;
 const B = 2;
@@ -799,8 +805,9 @@
     expect(result, expectedCode);
   }
 
-  void _parseTestUnit(String code) {
+  Future<Null> _parseTestUnit(String code) async {
     addTestSource(code);
-    testUnit = context.parseCompilationUnit(testSource);
+    ParseResult result = await driver.parseFile(testSource.fullName);
+    testUnit = result.unit;
   }
 }
diff --git a/pkg/analysis_server/test/services/correction/status_test.dart b/pkg/analysis_server/test/services/correction/status_test.dart
index 1775987..d66ad0d 100644
--- a/pkg/analysis_server/test/services/correction/status_test.dart
+++ b/pkg/analysis_server/test/services/correction/status_test.dart
@@ -43,7 +43,7 @@
     Element element = findElement('MyClass');
     SourceRange range = rangeElementName(element);
     SearchMatch match = new SearchMatchImpl(
-        context,
+        element.context,
         element.library.source.uri.toString(),
         element.source.uri.toString(),
         null,