Convert several test classes to use ResourceProviderMixin

Change-Id: I1c85c6f29ae74cca0b594fc1f9ddae098b815e72
Reviewed-on: https://dart-review.googlesource.com/31860
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index 31c8a50..9ba47f2 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -10,10 +10,10 @@
 import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/domain_server.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:analyzer_plugin/protocol/protocol_common.dart';
 import 'package:plugin/manager.dart';
 import 'package:test/test.dart';
@@ -29,10 +29,9 @@
 }
 
 @reflectiveTest
-class AnalysisServerTest {
+class AnalysisServerTest extends Object with ResourceProviderMixin {
   MockServerChannel channel;
   AnalysisServer server;
-  MemoryResourceProvider resourceProvider;
   MockPackageMapProvider packageMapProvider;
 
   /**
@@ -42,10 +41,10 @@
   Future do_not_test_no_duplicate_notifications() async {
     // Subscribe to STATUS so we'll know when analysis is done.
     server.serverServices = [ServerService.STATUS].toSet();
-    resourceProvider.newFolder('/foo');
-    resourceProvider.newFolder('/bar');
-    resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";');
-    File bar = resourceProvider.newFile('/bar/bar.dart', 'library bar;');
+    newFolder('/foo');
+    newFolder('/bar');
+    newFile('/foo/foo.dart', content: 'import "../bar/bar.dart";');
+    File bar = newFile('/bar/bar.dart', content: 'library bar;');
     server.setAnalysisRoots('0', ['/foo', '/bar'], [], {});
     Map<AnalysisService, Set<String>> subscriptions =
         <AnalysisService, Set<String>>{};
@@ -92,7 +91,6 @@
   void setUp() {
     processRequiredPlugins();
     channel = new MockServerChannel();
-    resourceProvider = new MemoryResourceProvider();
     // Create an SDK in the mock file system.
     new MockSdk(resourceProvider: resourceProvider);
     packageMapProvider = new MockPackageMapProvider();
@@ -116,9 +114,9 @@
 
   Future test_serverStatusNotifications() {
     server.serverServices.add(ServerService.STATUS);
-    resourceProvider.newFolder('/pkg');
-    resourceProvider.newFolder('/pkg/lib');
-    resourceProvider.newFile('/pkg/lib/test.dart', 'class C {}');
+    newFolder('/pkg');
+    newFolder('/pkg/lib');
+    newFile('/pkg/lib/test.dart', content: 'class C {}');
     server.setAnalysisRoots('0', ['/pkg'], [], {});
     // Pump the event queue to make sure the server has finished any
     // analysis.
@@ -144,8 +142,8 @@
 
   test_setAnalysisSubscriptions_fileInIgnoredFolder_newOptions() async {
     String path = '/project/samples/sample.dart';
-    resourceProvider.newFile(path, '');
-    resourceProvider.newFile('/project/analysis_options.yaml', r'''
+    newFile(path);
+    newFile('/project/analysis_options.yaml', content: r'''
 analyzer:
   exclude:
     - 'samples/**'
@@ -163,8 +161,8 @@
 
   test_setAnalysisSubscriptions_fileInIgnoredFolder_oldOptions() async {
     String path = '/project/samples/sample.dart';
-    resourceProvider.newFile(path, '');
-    resourceProvider.newFile('/project/.analysis_options', r'''
+    newFile(path);
+    newFile('/project/.analysis_options', content: r'''
 analyzer:
   exclude:
     - 'samples/**'
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 19419b7..7933584 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -2,8 +2,6 @@
 // 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.
 
-library test.context.directory.manager;
-
 import 'dart:async';
 
 import 'package:analysis_server/src/context_manager.dart';
@@ -12,7 +10,6 @@
 import 'package:analyzer/context/context_root.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
 import 'package:analyzer/source/error_processor.dart';
 import 'package:analyzer/src/context/builder.dart';
@@ -25,6 +22,7 @@
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/services/lint.dart';
 import 'package:analyzer/src/summary/summary_file_builder.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:analyzer/src/util/glob.dart';
 import 'package:front_end/src/api_prototype/byte_store.dart';
 import 'package:front_end/src/base/performance_logger.dart';
@@ -90,16 +88,16 @@
     //return super.test_embedder_added();
     fail('NoSuchMethodError');
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'nope.dart']);
-    String embedderPath = newFolder([projPath, 'embedder']);
-    newFile([embedderPath, 'entry.dart']);
-    String embedderSrcPath = newFolder([projPath, 'embedder', 'src']);
-    newFile([embedderSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/nope.dart');
+    String embedderPath = '$projPath/embedder';
+    newFile('$embedderPath/entry.dart');
+    String embedderSrcPath = '$projPath/embedder/src';
+    newFile('$embedderSrcPath/part.dart');
 
     // Setup _embedder.yaml.
-    newFile([libPath, '_embedder.yaml'], r'''
+    newFile('$libPath/_embedder.yaml', content: r'''
 embedded_libs:
   "dart:foobar": "../embedder/entry.dart"
   "dart:typed_data": "../embedder/src/part"
@@ -122,7 +120,7 @@
     expect(sourceFactory.forUri('dart:typed_data'), isNull);
 
     // Add .packages file that introduces a dependency with embedded libs.
-    newFile([projPath, '.packages'], r'''
+    newFile('$projPath/.packages', content: r'''
 test_pack:lib/''');
 
     await pumpEventQueue();
@@ -138,21 +136,21 @@
 
   test_embedder_packagespec() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'nope.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/nope.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Setup _embedder.yaml.
-    newFile([libPath, '_embedder.yaml'], r'''
+    newFile('$libPath/_embedder.yaml', content: r'''
 embedded_libs:
   "dart:foobar": "../sdk_ext/entry.dart"
   "dart:typed_data": "../sdk_ext/src/part"
   ''');
     // Setup .packages file
-    newFile([projPath, '.packages'], r'''
+    newFile('$projPath/.packages', content: r'''
 test_pack:lib/''');
     // Setup context.
 
@@ -240,14 +238,14 @@
     manager.setIgnorePatternsForContext(
         rootInfo, ['sdk_ext/**', 'lib/ignoreme.dart']);
     // Start creating files.
-    newFile([projPath, ContextManagerImpl.PUBSPEC_NAME]);
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'ignoreme.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    newFile('$projPath/${ContextManagerImpl.PUBSPEC_NAME}');
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/ignoreme.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Pump event loop so new files are discovered and added to context.
     await pumpEventQueue();
     // Verify that ignored files were ignored.
@@ -368,21 +366,21 @@
 
   test_sdk_ext_packagespec() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'nope.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/nope.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Setup sdk extension mapping.
-    newFile([libPath, '_sdkext'], r'''
+    newFile('$libPath/_sdkext', content: r'''
 {
   "dart:foobar": "../sdk_ext/entry.dart"
 }
 ''');
     // Setup .packages file
-    newFile([projPath, '.packages'], r'''
+    newFile('$projPath/.packages', content: r'''
 test_pack:lib/''');
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -429,13 +427,13 @@
   }
 
   void test_setRoots_addFolderWithNestedPackageSpec() {
-    String examplePath = newFolder([projPath, ContextManagerTest.EXAMPLE_NAME]);
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
+    String examplePath = '$projPath/${ContextManagerTest.EXAMPLE_NAME}';
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
 
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([examplePath, ContextManagerImpl.PACKAGE_SPEC_NAME]);
-    newFile([examplePath, 'example.dart']);
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}');
+    newFile('$libPath/main.dart');
+    newFile('$examplePath/${ContextManagerImpl.PACKAGE_SPEC_NAME}');
+    newFile('$examplePath/example.dart');
 
     packageMapProvider.packageMap['proj'] = <Folder>[
       resourceProvider.getResource(libPath)
@@ -458,14 +456,15 @@
   }
 
   void test_setRoots_addFolderWithNestedPubspec() {
-    String examplePath = newFolder([projPath, ContextManagerTest.EXAMPLE_NAME]);
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
+    String examplePath = '$projPath/${ContextManagerTest.EXAMPLE_NAME}';
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
 
-    newFile([projPath, ContextManagerImpl.PUBSPEC_NAME]);
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME], 'proj:lib/');
-    newFile([libPath, 'main.dart']);
-    newFile([examplePath, ContextManagerImpl.PUBSPEC_NAME]);
-    newFile([examplePath, 'example.dart']);
+    newFile('$projPath/${ContextManagerImpl.PUBSPEC_NAME}');
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'proj:lib/');
+    newFile('$libPath/main.dart');
+    newFile('$examplePath/${ContextManagerImpl.PUBSPEC_NAME}');
+    newFile('$examplePath/example.dart');
 
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
@@ -495,7 +494,7 @@
     String packagespecPath = path.posix.join(projPath, '.packages');
     resourceProvider.newFile(packagespecPath,
         'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
     File mainFile =
         resourceProvider.newFile(path.posix.join(libPath, 'main.dart'), '');
     Source source = mainFile.createSource();
@@ -546,17 +545,18 @@
   }
 
   void test_setRoots_addFolderWithPubspecAndLib() {
-    String binPath = newFolder([projPath, ContextManagerTest.BIN_NAME]);
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    String srcPath = newFolder([libPath, ContextManagerTest.SRC_NAME]);
-    String testPath = newFolder([projPath, ContextManagerTest.TEST_NAME]);
+    String binPath = '$projPath/${ContextManagerTest.BIN_NAME}';
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    String srcPath = '$libPath/${ContextManagerTest.SRC_NAME}';
+    String testPath = '$projPath/${ContextManagerTest.TEST_NAME}';
 
-    newFile([projPath, ContextManagerImpl.PUBSPEC_NAME]);
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME], 'proj:lib/');
-    String appPath = newFile([binPath, 'app.dart']);
-    newFile([libPath, 'main.dart']);
-    newFile([srcPath, 'internal.dart']);
-    String testFilePath = newFile([testPath, 'main_test.dart']);
+    newFile('$projPath/${ContextManagerImpl.PUBSPEC_NAME}');
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'proj:lib/');
+    String appPath = newFile('$binPath/app.dart').path;
+    newFile('$libPath/main.dart');
+    newFile('$srcPath/internal.dart');
+    String testFilePath = newFile('$testPath/main_test.dart').path;
 
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     Iterable<Source> sources = callbacks.currentFileSources(projPath);
@@ -609,10 +609,12 @@
     String projectBLib = '$root/sub/sub2/bbb/lib';
     String subProjectB_file = '$projectB/bin/b.dart';
     // create files
-    newFile([projectA, ContextManagerImpl.PUBSPEC_NAME]);
-    newFile([projectA, ContextManagerImpl.PACKAGE_SPEC_NAME], 'foo:lib/');
-    newFile([projectB, ContextManagerImpl.PUBSPEC_NAME]);
-    newFile([projectB, ContextManagerImpl.PACKAGE_SPEC_NAME], 'bar:lib/');
+    newFile('$projectA/${ContextManagerImpl.PUBSPEC_NAME}');
+    newFile('$projectA/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'foo:lib/');
+    newFile('$projectB/${ContextManagerImpl.PUBSPEC_NAME}');
+    newFile('$projectB/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'bar:lib/');
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subProjectA_file, 'library a;');
     resourceProvider.newFile(subProjectB_file, 'library b;');
@@ -640,8 +642,8 @@
   void test_setRoots_addPackageRoot() {
     String packagePathFoo = '/package1/foo';
     String packageRootPath = '/package2/foo';
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
-        'foo:file:///package1/foo');
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'foo:file:///package1/foo');
     Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
     List<String> includedPaths = <String>[projPath];
     List<String> excludedPaths = <String>[];
@@ -893,8 +895,8 @@
 
   void test_setRoots_newlyAddedFoldersGetProperPackageMap() {
     String packagePath = '/package/foo';
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
-        'foo:file:///package/foo');
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'foo:file:///package/foo');
     Folder packageFolder = resourceProvider.newFolder(packagePath);
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     expect(
@@ -939,7 +941,8 @@
 
   void test_setRoots_packageResolver() {
     String filePath = path.posix.join(projPath, 'lib', 'foo.dart');
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME], 'foo:lib/');
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'foo:lib/');
     resourceProvider.newFile(filePath, 'contents');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
@@ -1077,8 +1080,8 @@
     String packagePathFoo = '/package1/foo';
     String packageRootPath = '/package2/foo';
     Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
-        'foo:file:///package1/foo');
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'foo:file:///package1/foo');
     List<String> includedPaths = <String>[projPath];
     List<String> excludedPaths = <String>[];
     manager.setRoots(includedPaths, excludedPaths,
@@ -1655,7 +1658,7 @@
   }
 }
 
-abstract class ContextManagerTest {
+abstract class ContextManagerTest extends Object with ResourceProviderMixin {
   /**
    * The name of the 'bin' directory.
    */
@@ -1685,8 +1688,6 @@
 
   TestContextManagerCallbacks callbacks;
 
-  MemoryResourceProvider resourceProvider;
-
   MockPackageMapProvider packageMapProvider;
 
   UriResolver packageResolver = null;
@@ -1737,11 +1738,6 @@
 
   Map<String, List<Folder>> get _currentPackageMap => _packageMap(projPath);
 
-  void deleteFile(List<String> pathComponents) {
-    String filePath = path.posix.joinAll(pathComponents);
-    resourceProvider.deleteFile(filePath);
-  }
-
   /**
    * TODO(brianwilkerson) This doesn't add the strong mode processor when using
    * the new analysis driver.
@@ -1749,24 +1745,6 @@
   ErrorProcessor getProcessor(AnalysisError error) => errorProcessors
       .firstWhere((ErrorProcessor p) => p.appliesTo(error), orElse: () => null);
 
-  String newFile(List<String> pathComponents, [String content = '']) {
-    String filePath = path.posix.joinAll(pathComponents);
-    resourceProvider.newFile(filePath, content);
-    return filePath;
-  }
-
-  String newFileFromBytes(List<String> pathComponents, List<int> bytes) {
-    String filePath = path.posix.joinAll(pathComponents);
-    resourceProvider.newFileWithBytes(filePath, bytes);
-    return filePath;
-  }
-
-  String newFolder(List<String> pathComponents) {
-    String folderPath = path.posix.joinAll(pathComponents);
-    resourceProvider.newFolder(folderPath);
-    return folderPath;
-  }
-
   void processRequiredPlugins() {
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(AnalysisEngine.instance.requiredPlugins);
@@ -1778,7 +1756,6 @@
 
   void setUp() {
     processRequiredPlugins();
-    resourceProvider = new MemoryResourceProvider();
     resourceProvider.newFolder(projPath);
     packageMapProvider = new MockPackageMapProvider();
     // Create an SDK in the mock file system.
@@ -1834,9 +1811,13 @@
 abstract class ContextManagerWithOptionsTest extends ContextManagerTest {
   String get optionsFileName;
 
+  void deleteOptionsFile() {
+    deleteFile('$projPath/$optionsFileName');
+  }
+
   test_analysis_options_file_delete() async {
     // Setup analysis options
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 embedded_libs:
   "dart:foobar": "../sdk_ext/entry.dart"
 analyzer:
@@ -1859,7 +1840,7 @@
     expect(analysisOptions.enableStrictCallChecks, isTrue);
 
     // Remove options.
-    deleteFile([projPath, optionsFileName]);
+    deleteOptionsFile();
     await pumpEventQueue();
 
     // Verify defaults restored.
@@ -1873,8 +1854,8 @@
     // This fails because the ContextBuilder doesn't pick up the strongMode
     // flag from the embedder.yaml file.
     // Setup _embedder.yaml.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, '_embedder.yaml'], r'''
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/_embedder.yaml', content: r'''
 analyzer:
   strong-mode: true
   errors:
@@ -1885,11 +1866,11 @@
 ''');
 
     // Setup .packages file
-    newFile([projPath, '.packages'], r'''
+    newFile('$projPath/.packages', content: r'''
 test_pack:lib/''');
 
     // Setup analysis options
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   language:
     enableStrictCallChecks: true
@@ -1911,7 +1892,7 @@
     expect(lints, hasLength(2));
 
     // Remove options.
-    deleteFile([projPath, optionsFileName]);
+    deleteOptionsFile();
     await pumpEventQueue();
 
     // Verify defaults restored.
@@ -1924,17 +1905,17 @@
 
   test_analysis_options_include() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Setup analysis options file which includes another options file.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 include: other_options.yaml
 ''');
-    newFile([projPath, 'other_options.yaml'], r'''
+    newFile('$projPath/other_options.yaml', content: r'''
 analyzer:
   language:
     enableStrictCallChecks: true
@@ -1956,15 +1937,15 @@
 
   test_analysis_options_include_package() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Setup package
     String booLibPosixPath = '/my/pkg/boo/lib';
-    newFile([booLibPosixPath, 'other_options.yaml'], r'''
+    newFile('$booLibPosixPath/other_options.yaml', content: r'''
 analyzer:
   language:
     enableStrictCallChecks: true
@@ -1975,9 +1956,9 @@
     - camel_case_types
 ''');
     // Setup analysis options file which includes another options file.
-    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
-        'boo:$booLibPosixPath\n');
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
+        content: 'boo:$booLibPosixPath\n');
+    newFile('$projPath/$optionsFileName', content: r'''
 include: package:boo/other_options.yaml
 ''');
     // Setup context.
@@ -1992,16 +1973,16 @@
 
   test_analysis_options_parse_failure() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Setup analysis options file with ignore list.
-    String optionsFilePath = newFile([projPath, optionsFileName], r'''
+    String optionsFilePath = newFile('$projPath/$optionsFileName', content: r'''
 ;
-''');
+''').path;
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
@@ -2013,7 +1994,7 @@
   }
 
   test_deleteRoot_hasAnalysisOptions() async {
-    newFile([projPath, optionsFileName], '');
+    newFile('$projPath/$optionsFileName');
 
     // Add the root.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -2030,14 +2011,14 @@
     // This fails because the ContextBuilder doesn't pick up the strongMode
     // flag from the embedder.yaml file.
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([projPath, 'test', 'test.dart']);
-    newFile([sdkExtPath, 'entry.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$projPath/test', content: 'test.dart');
+    newFile('$sdkExtPath/entry.dart');
     List<int> bytes = new SummaryBuilder([], null, true).build();
-    newFileFromBytes([projPath, 'sdk.ds'], bytes);
+    newFileWithBytes('$projPath/sdk.ds', bytes);
     // Setup _embedder.yaml.
-    newFile([libPath, '_embedder.yaml'], r'''
+    newFile('$libPath/_embedder.yaml', content: r'''
 embedded_libs:
   "dart:foobar": "../sdk_ext/entry.dart"
 analyzer:
@@ -2051,11 +2032,11 @@
     - avoid_as
 ''');
     // Setup .packages file
-    newFile([projPath, '.packages'], r'''
+    newFile('$projPath/.packages', content: r'''
 test_pack:lib/''');
 
     // Setup analysis options
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - 'test/**'
@@ -2115,7 +2096,7 @@
 
   test_error_filter_analysis_option() async {
     // Create files.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   errors:
     unused_local_variable: ignore
@@ -2130,7 +2111,7 @@
 
   test_error_filter_analysis_option_multiple_filters() async {
     // Create files.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   errors:
     invalid_assignment: ignore
@@ -2148,7 +2129,7 @@
 
   test_error_filter_analysis_option_synonyms() async {
     // Create files.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   errors:
     unused_local_variable: ignore
@@ -2164,7 +2145,7 @@
 
   test_error_filter_analysis_option_unpsecified() async {
     // Create files.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
 #  errors:
 #    unused_local_variable: ignore
@@ -2230,15 +2211,15 @@
   test_path_filter_analysis_option() async {
     // This fails because we're not analyzing the analysis options file.
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'nope.dart']);
-    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
-    newFile([sdkExtPath, 'entry.dart']);
-    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
-    newFile([sdkExtSrcPath, 'part.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/nope.dart');
+    String sdkExtPath = '$projPath/sdk_ext';
+    newFile('$sdkExtPath/entry.dart');
+    String sdkExtSrcPath = '$projPath/sdk_ext/src';
+    newFile('$sdkExtSrcPath/part.dart');
     // Setup analysis options file with ignore list.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - lib/nope.dart
@@ -2260,19 +2241,19 @@
 
   test_path_filter_child_contexts_option() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'pubspec.yaml'], r'''
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/pubspec.yaml', content: r'''
 name: foobar
 ''');
-    String otherLibPath = newFolder([projPath, 'other_lib']);
-    newFile([otherLibPath, 'entry.dart']);
-    newFile([otherLibPath, 'pubspec.yaml'], r'''
+    String otherLibPath = '$projPath/other_lib';
+    newFile('$otherLibPath/entry.dart');
+    newFile('$otherLibPath/pubspec.yaml', content: r'''
 name: other_lib
 ''');
     // Setup analysis options file with ignore list that ignores the 'other_lib'
     // directory by name.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - 'other_lib'
@@ -2290,19 +2271,19 @@
 
   test_path_filter_recursive_wildcard_child_contexts_option() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'pubspec.yaml'], r'''
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/pubspec.yaml', content: r'''
   name: foobar
   ''');
-    String otherLibPath = newFolder([projPath, 'other_lib']);
-    newFile([otherLibPath, 'entry.dart']);
-    newFile([otherLibPath, 'pubspec.yaml'], r'''
+    String otherLibPath = '$projPath/other_lib';
+    newFile('$otherLibPath/entry.dart');
+    newFile('$otherLibPath/pubspec.yaml', content: r'''
   name: other_lib
   ''');
     // Setup analysis options file with ignore list that ignores 'other_lib'
     // and all descendants.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - 'other_lib/**'
@@ -2321,19 +2302,19 @@
 
   test_path_filter_wildcard_child_contexts_option() async {
     // Create files.
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
-    newFile([libPath, 'pubspec.yaml'], r'''
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
+    newFile('$libPath/pubspec.yaml', content: r'''
 name: foobar
 ''');
-    String otherLibPath = newFolder([projPath, 'other_lib']);
-    newFile([otherLibPath, 'entry.dart']);
-    newFile([otherLibPath, 'pubspec.yaml'], r'''
+    String otherLibPath = '$projPath/other_lib';
+    newFile('$otherLibPath/entry.dart');
+    newFile('$otherLibPath/pubspec.yaml', content: r'''
 name: other_lib
 ''');
     // Setup analysis options file with ignore list that ignores 'other_lib'
     // and all immediate children.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - 'other_lib/*'
@@ -2356,7 +2337,7 @@
     // create files
     resourceProvider.newFile(projectPubspec, 'name: project');
     resourceProvider.newFile(examplePubspec, 'name: example');
-    newFile([project, optionsFileName], r'''
+    newFile('$project/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - 'example'
@@ -2390,7 +2371,7 @@
     // create files
     resourceProvider.newFile(aPubspec, 'name: aaa');
     resourceProvider.newFile(cPubspec, 'name: ccc');
-    newFile([a, optionsFileName], r'''
+    newFile('$a/$optionsFileName', content: r'''
 analyzer:
   exclude:
     - 'b**'
@@ -2417,12 +2398,12 @@
 
   test_strong_mode_analysis_option() async {
     // Create files.
-    newFile([projPath, optionsFileName], r'''
+    newFile('$projPath/$optionsFileName', content: r'''
 analyzer:
   strong-mode: true
 ''');
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
-    newFile([libPath, 'main.dart']);
+    String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+    newFile('$libPath/main.dart');
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // Verify that analysis options was parsed and strong-mode set.
@@ -2430,9 +2411,9 @@
   }
 
   test_watchEvents() async {
-    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
+    String libPath = newFolder('$projPath/${ContextManagerTest.LIB_NAME}').path;
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    newFile([libPath, 'main.dart']);
+    newFile('$libPath/main.dart');
     await new Future.delayed(new Duration(milliseconds: 1));
     expect(callbacks.watchEvents, hasLength(1));
   }
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 334e7f9..3a6a94c 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -9,10 +9,10 @@
 import 'package:analysis_server/protocol/protocol_generated.dart';
 import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/domain_analysis.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:analyzer_plugin/protocol/protocol_common.dart';
 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
 import 'package:plugin/manager.dart';
@@ -26,346 +26,279 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisDomainTest);
+    defineReflectiveTests(AnalysisDomainHandlerTest);
     defineReflectiveTests(SetSubscriptionsTest);
   });
-
-  MockServerChannel serverChannel;
-  MemoryResourceProvider resourceProvider;
-  AnalysisServer server;
-  AnalysisDomainHandler handler;
-
-  void processRequiredPlugins() {
-    ExtensionManager manager = new ExtensionManager();
-    manager.processPlugins(AnalysisEngine.instance.requiredPlugins);
-  }
-
-  setUp(() {
-    serverChannel = new MockServerChannel();
-    resourceProvider = new MemoryResourceProvider();
-    processRequiredPlugins();
-    // Create an SDK in the mock file system.
-    new MockSdk(resourceProvider: resourceProvider);
-    server = new AnalysisServer(
-        serverChannel,
-        resourceProvider,
-        new MockPackageMapProvider(),
-        new AnalysisServerOptions(),
-        new DartSdkManager('/', false),
-        InstrumentationService.NULL_SERVICE);
-    handler = new AnalysisDomainHandler(server);
-  });
-
-  group('updateContent', testUpdateContent);
-
-  group('AnalysisDomainHandler', () {
-    // TODO(brianwilkerson) Re-enable these tests if we re-enable the
-    // analysis.getReachableSources request.
-//    group('getReachableSources', () {
-//      test('valid sources', () async {
-//        String fileA = '/project/a.dart';
-//        String fileB = '/project/b.dart';
-//        resourceProvider.newFile(fileA, 'import "b.dart";');
-//        resourceProvider.newFile(fileB, '');
-//
-//        server.setAnalysisRoots('0', ['/project/'], [], {});
-//
-//        await server.onAnalysisComplete;
-//
-//        var request =
-//            new AnalysisGetReachableSourcesParams(fileA).toRequest('0');
-//        var response = handler.handleRequest(request);
-//
-//        Map json = response.toJson()[Response.RESULT];
-//
-//        // Sanity checks.
-//        expect(json['sources'], hasLength(6));
-//        expect(json['sources']['file:///project/a.dart'],
-//            unorderedEquals(['dart:core', 'file:///project/b.dart']));
-//        expect(json['sources']['file:///project/b.dart'], ['dart:core']);
-//      });
-//
-//      test('invalid source', () async {
-//        resourceProvider.newFile('/project/a.dart', 'import "b.dart";');
-//        server.setAnalysisRoots('0', ['/project/'], [], {});
-//
-//        await server.onAnalysisComplete;
-//
-//        var request =
-//            new AnalysisGetReachableSourcesParams('/does/not/exist.dart')
-//                .toRequest('0');
-//        var response = handler.handleRequest(request);
-//        expect(response.error, isNotNull);
-//        expect(response.error.code,
-//            RequestErrorCode.GET_REACHABLE_SOURCES_INVALID_FILE);
-//      });
-//    });
-
-    group('setAnalysisRoots', () {
-      Response testSetAnalysisRoots(
-          List<String> included, List<String> excluded) {
-        Request request = new AnalysisSetAnalysisRootsParams(included, excluded)
-            .toRequest('0');
-        return handler.handleRequest(request);
-      }
-
-      group('excluded', () {
-        test('excluded folder', () async {
-          String fileA = '/project/aaa/a.dart';
-          String fileB = '/project/bbb/b.dart';
-          resourceProvider.newFile(fileA, '// a');
-          resourceProvider.newFile(fileB, '// b');
-          var response = testSetAnalysisRoots(['/project'], ['/project/bbb']);
-          expect(response, isResponseSuccess('0'));
-        });
-
-        test('not absolute', () async {
-          var response = testSetAnalysisRoots([], ['foo/bar']);
-          expect(
-              response,
-              isResponseFailure(
-                  '0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
-        });
-
-        test('not normalized', () async {
-          var response = testSetAnalysisRoots([], ['/foo/../bar']);
-          expect(
-              response,
-              isResponseFailure(
-                  '0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
-        });
-      });
-
-      group('included', () {
-        test('new folder', () async {
-          String file = '/project/bin/test.dart';
-          resourceProvider.newFile('/project/pubspec.yaml', 'name: project');
-          resourceProvider.newFile(file, 'main() {}');
-          var response = testSetAnalysisRoots(['/project'], []);
-          var serverRef = server;
-          expect(response, isResponseSuccess('0'));
-          // verify that unit is resolved eventually
-          await server.onAnalysisComplete;
-          var unit = await serverRef.getResolvedCompilationUnit(file);
-          expect(unit, isNotNull);
-        });
-
-        test('nonexistent folder', () async {
-          String fileB = '/project_b/b.dart';
-          resourceProvider.newFile(fileB, '// b');
-          var response = testSetAnalysisRoots(['/project_a', '/project_b'], []);
-          var serverRef = server;
-          expect(response, isResponseSuccess('0'));
-          // Non-existence of /project_a should not prevent files in /project_b
-          // from being analyzed.
-          await server.onAnalysisComplete;
-          var unit = await serverRef.getResolvedCompilationUnit(fileB);
-          expect(unit, isNotNull);
-        });
-
-        test('not absolute', () async {
-          var response = testSetAnalysisRoots(['foo/bar'], []);
-          expect(
-              response,
-              isResponseFailure(
-                  '0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
-        });
-
-        test('not normalized', () async {
-          var response = testSetAnalysisRoots(['/foo/../bar'], []);
-          expect(
-              response,
-              isResponseFailure(
-                  '0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
-        });
-      });
-    });
-
-    group('setPriorityFiles', () {
-      test('invalid', () {
-        var request = new AnalysisSetPriorityFilesParams(['/project/lib.dart'])
-            .toRequest('0');
-        var response = handler.handleRequest(request);
-        expect(response, isResponseSuccess('0'));
-      });
-
-      test('valid', () {
-        resourceProvider.newFolder('/p1');
-        resourceProvider.newFile('/p1/a.dart', 'library a;');
-        resourceProvider.newFolder('/p2');
-        resourceProvider.newFile('/p2/b.dart', 'library b;');
-        resourceProvider.newFile('/p2/c.dart', 'library c;');
-
-        var setRootsRequest =
-            new AnalysisSetAnalysisRootsParams(['/p1', '/p2'], [])
-                .toRequest('0');
-        var setRootsResponse = handler.handleRequest(setRootsRequest);
-        expect(setRootsResponse, isResponseSuccess('0'));
-
-        void setPriorityFiles(List<String> fileList) {
-          var request =
-              new AnalysisSetPriorityFilesParams(fileList).toRequest('0');
-          var response = handler.handleRequest(request);
-          expect(response, isResponseSuccess('0'));
-          // TODO(brianwilkerson) Enable the line below after getPriorityFiles
-          // has been implemented.
-          // expect(server.getPriorityFiles(), unorderedEquals(fileList));
-        }
-
-        setPriorityFiles(['/p1/a.dart', '/p2/b.dart']);
-        setPriorityFiles(['/p2/b.dart', '/p2/c.dart']);
-        setPriorityFiles([]);
-      });
-    });
-
-    group('updateOptions', () {
-      test('invalid', () {
-        var request = new Request('0', ANALYSIS_REQUEST_UPDATE_OPTIONS, {
-          ANALYSIS_REQUEST_UPDATE_OPTIONS_OPTIONS: {'not-an-option': true}
-        });
-        var response = handler.handleRequest(request);
-        // Invalid options should be silently ignored.
-        expect(response, isResponseSuccess('0'));
-      });
-
-      test('null', () {
-        // null is allowed as a synonym for {}.
-        var request = new Request('0', ANALYSIS_REQUEST_UPDATE_OPTIONS,
-            {ANALYSIS_REQUEST_UPDATE_OPTIONS_OPTIONS: null});
-        var response = handler.handleRequest(request);
-        expect(response, isResponseSuccess('0'));
-      });
-    });
-  });
 }
 
-testUpdateContent() {
-  test('bad type', () {
+@reflectiveTest
+class AnalysisDomainHandlerTest extends AbstractAnalysisTest {
+  Future outOfRangeTest(SourceEdit edit) async {
+    AnalysisTestHelper helper = new AnalysisTestHelper();
+    helper.createSingleFileProject('library A;');
+    await helper.onAnalysisComplete;
+    helper.sendContentChange(new AddContentOverlay('library B;'));
+    await helper.onAnalysisComplete;
+    ChangeContentOverlay contentChange = new ChangeContentOverlay([edit]);
+    Request request =
+        new AnalysisUpdateContentParams({helper.testFile: contentChange})
+            .toRequest('0');
+    Response response = helper.handler.handleRequest(request);
+    expect(response,
+        isResponseFailure('0', RequestErrorCode.INVALID_OVERLAY_CHANGE));
+  }
+
+  test_setAnalysisRoots_excludedFolder() async {
+    String fileA = '/project/aaa/a.dart';
+    String fileB = '/project/bbb/b.dart';
+    resourceProvider.newFile(fileA, '// a');
+    resourceProvider.newFile(fileB, '// b');
+    var response = testSetAnalysisRoots(['/project'], ['/project/bbb']);
+    expect(response, isResponseSuccess('0'));
+  }
+
+  test_setAnalysisRoots_included_newFolder() async {
+    String file = '/project/bin/test.dart';
+    resourceProvider.newFile('/project/pubspec.yaml', 'name: project');
+    resourceProvider.newFile(file, 'main() {}');
+    var response = testSetAnalysisRoots(['/project'], []);
+    var serverRef = server;
+    expect(response, isResponseSuccess('0'));
+    // verify that unit is resolved eventually
+    await server.onAnalysisComplete;
+    var unit = await serverRef.getResolvedCompilationUnit(file);
+    expect(unit, isNotNull);
+  }
+
+  test_setAnalysisRoots_included_nonexistentFolder() async {
+    String fileB = '/project_b/b.dart';
+    resourceProvider.newFile(fileB, '// b');
+    var response = testSetAnalysisRoots(['/project_a', '/project_b'], []);
+    var serverRef = server;
+    expect(response, isResponseSuccess('0'));
+    // Non-existence of /project_a should not prevent files in /project_b
+    // from being analyzed.
+    await server.onAnalysisComplete;
+    var unit = await serverRef.getResolvedCompilationUnit(fileB);
+    expect(unit, isNotNull);
+  }
+
+  test_setAnalysisRoots_included_notAbsolute() async {
+    var response = testSetAnalysisRoots(['foo/bar'], []);
+    expect(response,
+        isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
+  }
+
+  test_setAnalysisRoots_included_notNormalized() async {
+    var response = testSetAnalysisRoots(['/foo/../bar'], []);
+    expect(response,
+        isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
+  }
+
+  test_setAnalysisRoots_notAbsolute() async {
+    var response = testSetAnalysisRoots([], ['foo/bar']);
+    expect(response,
+        isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
+  }
+
+  test_setAnalysisRoots_notNormalized() async {
+    var response = testSetAnalysisRoots([], ['/foo/../bar']);
+    expect(response,
+        isResponseFailure('0', RequestErrorCode.INVALID_FILE_PATH_FORMAT));
+  }
+
+  test_setPriorityFiles_invalid() {
+    var request = new AnalysisSetPriorityFilesParams(['/project/lib.dart'])
+        .toRequest('0');
+    var response = handler.handleRequest(request);
+    expect(response, isResponseSuccess('0'));
+  }
+
+  test_setPriorityFiles_valid() {
+    resourceProvider.newFolder('/p1');
+    resourceProvider.newFile('/p1/a.dart', 'library a;');
+    resourceProvider.newFolder('/p2');
+    resourceProvider.newFile('/p2/b.dart', 'library b;');
+    resourceProvider.newFile('/p2/c.dart', 'library c;');
+
+    var setRootsRequest =
+        new AnalysisSetAnalysisRootsParams(['/p1', '/p2'], []).toRequest('0');
+    var setRootsResponse = handler.handleRequest(setRootsRequest);
+    expect(setRootsResponse, isResponseSuccess('0'));
+
+    void setPriorityFiles(List<String> fileList) {
+      var request = new AnalysisSetPriorityFilesParams(fileList).toRequest('0');
+      var response = handler.handleRequest(request);
+      expect(response, isResponseSuccess('0'));
+      // TODO(brianwilkerson) Enable the line below after getPriorityFiles
+      // has been implemented.
+      // expect(server.getPriorityFiles(), unorderedEquals(fileList));
+    }
+
+    setPriorityFiles(['/p1/a.dart', '/p2/b.dart']);
+    setPriorityFiles(['/p2/b.dart', '/p2/c.dart']);
+    setPriorityFiles([]);
+  }
+
+  test_updateContent_badType() async {
     AnalysisTestHelper helper = new AnalysisTestHelper();
     helper.createSingleFileProject('// empty');
-    return helper.onAnalysisComplete.then((_) {
-      Request request = new Request('0', ANALYSIS_REQUEST_UPDATE_CONTENT, {
-        ANALYSIS_REQUEST_UPDATE_CONTENT_FILES: {
-          helper.testFile: {
-            'type': 'foo',
-          }
+    await helper.onAnalysisComplete;
+    Request request = new Request('0', ANALYSIS_REQUEST_UPDATE_CONTENT, {
+      ANALYSIS_REQUEST_UPDATE_CONTENT_FILES: {
+        helper.testFile: {
+          'type': 'foo',
         }
-      });
-      Response response = helper.handler.handleRequest(request);
-      expect(response, isResponseFailure('0'));
+      }
     });
-  });
+    Response response = helper.handler.handleRequest(request);
+    expect(response, isResponseFailure('0'));
+  }
 
-  test('full content', () {
+  test_updateContent_changeOnDisk_duringOverride() async {
+    AnalysisTestHelper helper = new AnalysisTestHelper();
+    helper.createSingleFileProject('library A;');
+    await helper.onAnalysisComplete;
+    // update code
+    helper.sendContentChange(new AddContentOverlay('library B;'));
+    // There should be no errors
+    await helper.onAnalysisComplete;
+    expect(helper.getTestErrors(), hasLength(0));
+    // Change file on disk, adding a syntax error.
+    helper.resourceProvider.modifyFile(helper.testFile, 'library lib');
+    // There should still be no errors (file should not have been reread).
+    await helper.onAnalysisComplete;
+    expect(helper.getTestErrors(), hasLength(0));
+    // Send a content change with a null content param--file should be
+    // reread from disk.
+    helper.sendContentChange(new RemoveContentOverlay());
+    // There should be errors now.
+    await helper.onAnalysisComplete;
+    expect(helper.getTestErrors(), hasLength(1));
+  }
+
+  test_updateContent_changeOnDisk_normal() async {
+    AnalysisTestHelper helper = new AnalysisTestHelper();
+    helper.createSingleFileProject('library A;');
+    await helper.onAnalysisComplete;
+    // There should be no errors
+    expect(helper.getTestErrors(), hasLength(0));
+    // Change file on disk, adding a syntax error.
+    helper.resourceProvider.modifyFile(helper.testFile, 'library lib');
+    // There should be errors now.
+    await pumpEventQueue();
+    await helper.onAnalysisComplete;
+    expect(helper.getTestErrors(), hasLength(1));
+  }
+
+  test_updateContent_fullContent() async {
     AnalysisTestHelper helper = new AnalysisTestHelper();
     helper.createSingleFileProject('// empty');
-    return helper.onAnalysisComplete.then((_) {
-      // no errors initially
-      List<AnalysisError> errors = helper.getTestErrors();
-      expect(errors, isEmpty);
-      // update code
-      helper.sendContentChange(new AddContentOverlay('library lib'));
-      // wait, there is an error
-      return helper.onAnalysisComplete.then((_) {
-        List<AnalysisError> errors = helper.getTestErrors();
-        expect(errors, hasLength(1));
-      });
-    });
-  });
+    await helper.onAnalysisComplete;
+    // no errors initially
+    List<AnalysisError> errors = helper.getTestErrors();
+    expect(errors, isEmpty);
+    // update code
+    helper.sendContentChange(new AddContentOverlay('library lib'));
+    // wait, there is an error
+    await helper.onAnalysisComplete;
+    errors = helper.getTestErrors();
+    expect(errors, hasLength(1));
+  }
 
-  test('incremental', () {
+  test_updateContent_incremental() async {
     AnalysisTestHelper helper = new AnalysisTestHelper();
     String initialContent = 'library A;';
     helper.createSingleFileProject(initialContent);
-    return helper.onAnalysisComplete.then((_) {
-      // no errors initially
-      List<AnalysisError> errors = helper.getTestErrors();
-      expect(errors, isEmpty);
-      // Add the file to the cache
-      helper.sendContentChange(new AddContentOverlay(initialContent));
-      // update code
-      helper.sendContentChange(new ChangeContentOverlay(
-          [new SourceEdit('library '.length, 'A;'.length, 'lib')]));
-      // wait, there is an error
-      return helper.onAnalysisComplete.then((_) {
-        List<AnalysisError> errors = helper.getTestErrors();
-        expect(errors, hasLength(1));
-      });
-    });
-  });
+    await helper.onAnalysisComplete;
+    // no errors initially
+    List<AnalysisError> errors = helper.getTestErrors();
+    expect(errors, isEmpty);
+    // Add the file to the cache
+    helper.sendContentChange(new AddContentOverlay(initialContent));
+    // update code
+    helper.sendContentChange(new ChangeContentOverlay(
+        [new SourceEdit('library '.length, 'A;'.length, 'lib')]));
+    // wait, there is an error
+    await helper.onAnalysisComplete;
+    errors = helper.getTestErrors();
+    expect(errors, hasLength(1));
+  }
 
-  test('change on disk, normal', () {
-    AnalysisTestHelper helper = new AnalysisTestHelper();
-    helper.createSingleFileProject('library A;');
-    return helper.onAnalysisComplete.then((_) {
-      // There should be no errors
-      expect(helper.getTestErrors(), hasLength(0));
-      // Change file on disk, adding a syntax error.
-      helper.resourceProvider.modifyFile(helper.testFile, 'library lib');
-      // There should be errors now.
-      return pumpEventQueue().then((_) {
-        return helper.onAnalysisComplete.then((_) {
-          expect(helper.getTestErrors(), hasLength(1));
-        });
-      });
-    });
-  });
+  test_updateContent_outOfRange_beyondEnd() {
+    return outOfRangeTest(new SourceEdit(6, 6, 'foo'));
+  }
 
-  test('change on disk, during override', () {
-    AnalysisTestHelper helper = new AnalysisTestHelper();
-    helper.createSingleFileProject('library A;');
-    return helper.onAnalysisComplete.then((_) {
-      // update code
-      helper.sendContentChange(new AddContentOverlay('library B;'));
-      // There should be no errors
-      return helper.onAnalysisComplete.then((_) {
-        expect(helper.getTestErrors(), hasLength(0));
-        // Change file on disk, adding a syntax error.
-        helper.resourceProvider.modifyFile(helper.testFile, 'library lib');
-        // There should still be no errors (file should not have been reread).
-        return helper.onAnalysisComplete.then((_) {
-          expect(helper.getTestErrors(), hasLength(0));
-          // Send a content change with a null content param--file should be
-          // reread from disk.
-          helper.sendContentChange(new RemoveContentOverlay());
-          // There should be errors now.
-          return helper.onAnalysisComplete.then((_) {
-            expect(helper.getTestErrors(), hasLength(1));
-          });
-        });
-      });
-    });
-  });
+  test_updateContent_outOfRange_negativeLength() {
+    return outOfRangeTest(new SourceEdit(3, -1, 'foo'));
+  }
 
-  group('out of range', () {
-    Future outOfRangeTest(SourceEdit edit) {
-      AnalysisTestHelper helper = new AnalysisTestHelper();
-      helper.createSingleFileProject('library A;');
-      return helper.onAnalysisComplete.then((_) {
-        helper.sendContentChange(new AddContentOverlay('library B;'));
-        return helper.onAnalysisComplete.then((_) {
-          ChangeContentOverlay contentChange = new ChangeContentOverlay([edit]);
-          Request request =
-              new AnalysisUpdateContentParams({helper.testFile: contentChange})
-                  .toRequest('0');
-          Response response = helper.handler.handleRequest(request);
-          expect(response,
-              isResponseFailure('0', RequestErrorCode.INVALID_OVERLAY_CHANGE));
-        });
-      });
-    }
+  test_updateContent_outOfRange_negativeOffset() {
+    return outOfRangeTest(new SourceEdit(-1, 3, 'foo'));
+  }
 
-    test('negative length', () {
-      return outOfRangeTest(new SourceEdit(3, -1, 'foo'));
+  test_updateOptions_invalid() {
+    var request = new Request('0', ANALYSIS_REQUEST_UPDATE_OPTIONS, {
+      ANALYSIS_REQUEST_UPDATE_OPTIONS_OPTIONS: {'not-an-option': true}
     });
+    var response = handler.handleRequest(request);
+    // Invalid options should be silently ignored.
+    expect(response, isResponseSuccess('0'));
+  }
 
-    test('negative offset', () {
-      return outOfRangeTest(new SourceEdit(-1, 3, 'foo'));
-    });
+  test_updateOptions_null() {
+    // null is allowed as a synonym for {}.
+    var request = new Request('0', ANALYSIS_REQUEST_UPDATE_OPTIONS,
+        {ANALYSIS_REQUEST_UPDATE_OPTIONS_OPTIONS: null});
+    var response = handler.handleRequest(request);
+    expect(response, isResponseSuccess('0'));
+  }
 
-    test('beyond end', () {
-      return outOfRangeTest(new SourceEdit(6, 6, 'foo'));
-    });
-  });
+  Response testSetAnalysisRoots(List<String> included, List<String> excluded) {
+    Request request =
+        new AnalysisSetAnalysisRootsParams(included, excluded).toRequest('0');
+    return handler.handleRequest(request);
+  }
+
+  xtest_getReachableSources_invalidSource() async {
+    // TODO(brianwilkerson) Re-enable this test if we re-enable the
+    // analysis.getReachableSources request.
+    resourceProvider.newFile('/project/a.dart', 'import "b.dart";');
+    server.setAnalysisRoots('0', ['/project/'], [], {});
+
+    await server.onAnalysisComplete;
+
+    var request = new AnalysisGetReachableSourcesParams('/does/not/exist.dart')
+        .toRequest('0');
+    var response = handler.handleRequest(request);
+    expect(response.error, isNotNull);
+    expect(response.error.code,
+        RequestErrorCode.GET_REACHABLE_SOURCES_INVALID_FILE);
+  }
+
+  xtest_getReachableSources_validSources() async {
+    // TODO(brianwilkerson) Re-enable this test if we re-enable the
+    // analysis.getReachableSources request.
+    String fileA = '/project/a.dart';
+    String fileB = '/project/b.dart';
+    resourceProvider.newFile(fileA, 'import "b.dart";');
+    resourceProvider.newFile(fileB, '');
+
+    server.setAnalysisRoots('0', ['/project/'], [], {});
+
+    await server.onAnalysisComplete;
+
+    var request = new AnalysisGetReachableSourcesParams(fileA).toRequest('0');
+    var response = handler.handleRequest(request);
+
+    Map json = response.toJson()[Response.RESULT];
+
+    // Sanity checks.
+    expect(json['sources'], hasLength(6));
+    expect(json['sources']['file:///project/a.dart'],
+        unorderedEquals(['dart:core', 'file:///project/b.dart']));
+    expect(json['sources']['file:///project/b.dart'], ['dart:core']);
+  }
 }
 
 @reflectiveTest
@@ -407,9 +340,8 @@
 /**
  * A helper to test 'analysis.*' requests.
  */
-class AnalysisTestHelper {
+class AnalysisTestHelper extends Object with ResourceProviderMixin {
   MockServerChannel serverChannel;
-  MemoryResourceProvider resourceProvider;
   AnalysisServer server;
   AnalysisDomainHandler handler;
 
@@ -425,7 +357,6 @@
   AnalysisTestHelper() {
     processRequiredPlugins();
     serverChannel = new MockServerChannel();
-    resourceProvider = new MemoryResourceProvider();
     // Create an SDK in the mock file system.
     new MockSdk(resourceProvider: resourceProvider);
     server = new AnalysisServer(
@@ -490,7 +421,7 @@
    * Creates an empty project `/project`.
    */
   void createEmptyProject() {
-    resourceProvider.newFolder('/project');
+    newFolder('/project');
     Request request =
         new AnalysisSetAnalysisRootsParams(['/project'], []).toRequest('0');
     handleSuccessfulRequest(request);
@@ -502,8 +433,8 @@
    */
   void createSingleFileProject(code) {
     this.testCode = _getCodeString(code);
-    resourceProvider.newFolder('/project');
-    resourceProvider.newFile(testFile, testCode);
+    newFolder('/project');
+    newFile(testFile, content: testCode);
     Request request =
         new AnalysisSetAnalysisRootsParams(['/project'], []).toRequest('0');
     handleSuccessfulRequest(request);
@@ -601,11 +532,6 @@
     handleSuccessfulRequest(request);
   }
 
-  String setFileContent(String path, String content) {
-    resourceProvider.newFile(path, content);
-    return path;
-  }
-
   /**
    * Stops the associated server.
    */
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart
index 678806c..1e93e6a 100644
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart
@@ -8,13 +8,13 @@
 import 'package:analysis_server/src/services/search/search_engine_internal.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/source/package_map_resolver.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:front_end/src/api_prototype/byte_store.dart';
 import 'package:front_end/src/base/performance_logger.dart';
 import 'package:test/test.dart';
@@ -29,8 +29,7 @@
 }
 
 @reflectiveTest
-class SearchEngineImplTest {
-  final MemoryResourceProvider provider = new MemoryResourceProvider();
+class SearchEngineImplTest extends Object with ResourceProviderMixin {
   DartSdk sdk;
   final ByteStore byteStore = new MemoryByteStore();
   final FileContentOverlay contentOverlay = new FileContentOverlay();
@@ -41,36 +40,32 @@
   AnalysisDriverScheduler scheduler;
 
   void setUp() {
-    sdk = new MockSdk(resourceProvider: provider);
+    sdk = new MockSdk(resourceProvider: resourceProvider);
     logger = new PerformanceLog(logBuffer);
     scheduler = new AnalysisDriverScheduler(logger);
     scheduler.start();
   }
 
   test_membersOfSubtypes_hasMembers() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-    var c = _p('/test/c.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class A {
   void a() {}
   void b() {}
   void c() {}
 }
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 class B extends A {
   void a() {}
 }
-''');
-    provider.newFile(c, '''
+''').path;
+    var c = newFile('/test/c.dart', content: '''
 import 'a.dart';
 class C extends A {
   void b() {}
 }
-''');
+''').path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -89,20 +84,17 @@
   }
 
   test_membersOfSubtypes_noMembers() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class A {
   void a() {}
   void b() {}
   void c() {}
 }
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 class B extends A {}
-''');
+''').path;
 
     var driver = _newDriver();
 
@@ -119,22 +111,19 @@
   }
 
   test_membersOfSubtypes_noSubtypes() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class A {
   void a() {}
   void b() {}
   void c() {}
 }
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 class B {
   void a() {}
 }
-''');
+''').path;
 
     var driver = _newDriver();
 
@@ -151,10 +140,7 @@
   }
 
   test_membersOfSubtypes_private() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class A {
   void a() {}
   void _b() {}
@@ -163,8 +149,8 @@
 class B extends A {
   void _b() {}
 }
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 class C extends A {
   void a() {}
@@ -173,7 +159,7 @@
 class D extends B {
   void _c() {}
 }
-''');
+''').path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -191,14 +177,12 @@
   }
 
   test_searchAllSubtypes() async {
-    var p = _p('/test.dart');
-
-    provider.newFile(p, '''
+    var p = newFile('/test.dart', content: '''
 class T {}
 class A extends T {}
 class B extends A {}
 class C implements B {}
-''');
+''').path;
 
     var driver = _newDriver();
     driver.addFile(p);
@@ -215,18 +199,15 @@
   }
 
   test_searchAllSubtypes_acrossDrivers() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class T {}
 class A extends T {}
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 class B extends A {}
 class C extends B {}
-''');
+''').path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -246,9 +227,6 @@
   }
 
   test_searchMemberDeclarations() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
     var codeA = '''
 class A {
   int test; // 1
@@ -263,8 +241,8 @@
 int test;
 ''';
 
-    provider.newFile(a, codeA);
-    provider.newFile(b, codeB);
+    var a = newFile('/test/a.dart', content: codeA).path;
+    var b = newFile('/test/b.dart', content: codeB).path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -295,23 +273,20 @@
   }
 
   test_searchMemberReferences() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class A {
   int test;
 }
 foo(p) {
   p.test;
 }
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 bar(p) {
   p.test = 1;
 }
-''');
+''').path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -334,17 +309,14 @@
   }
 
   test_searchReferences() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class T {}
 T a;
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 import 'a.dart';
 T b;
-''');
+''').path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -365,17 +337,14 @@
   }
 
   test_searchTopLevelDeclarations() async {
-    var a = _p('/test/a.dart');
-    var b = _p('/test/b.dart');
-
-    provider.newFile(a, '''
+    var a = newFile('/test/a.dart', content: '''
 class A {}
 int a;
-''');
-    provider.newFile(b, '''
+''').path;
+    var b = newFile('/test/b.dart', content: '''
 class B {}
 get b => 42;
-''');
+''').path;
 
     var driver1 = _newDriver();
     var driver2 = _newDriver();
@@ -406,25 +375,23 @@
   }
 
   test_searchTopLevelDeclarations_dependentPackage() async {
-    var a = _p('/a/lib/a.dart');
-    provider.newFile(a, '''
+    var a = newFile('/a/lib/a.dart', content: '''
 class A {}
 ''');
     var driver1 = _newDriver();
-    driver1.addFile(a);
+    driver1.addFile(a.path);
 
     // The package:b uses the class A from the package:a,
     // so it sees the declaration the element A.
-    var b = _p('/b/lib/b.dart');
-    provider.newFile(b, '''
+    var b = newFile('/b/lib/b.dart', content: '''
 import 'package:a/a.dart';
 class B extends A {}
 ''');
     var driver2 = _newDriver(
-        packageUriResolver: new PackageMapUriResolver(provider, {
-      'a': [provider.getFile(a).parent]
+        packageUriResolver: new PackageMapUriResolver(resourceProvider, {
+      'a': [a.parent]
     }));
-    driver2.addFile(b);
+    driver2.addFile(b.path);
 
     while (scheduler.isAnalyzing) {
       await new Future.delayed(new Duration(milliseconds: 1));
@@ -451,23 +418,21 @@
   AnalysisDriver _newDriver({UriResolver packageUriResolver}) {
     var resolvers = <UriResolver>[
       new DartUriResolver(sdk),
-      new ResourceUriResolver(provider)
+      new ResourceUriResolver(resourceProvider)
     ];
     if (packageUriResolver != null) {
       resolvers.add(packageUriResolver);
     }
-    resolvers.add(new ResourceUriResolver(provider));
+    resolvers.add(new ResourceUriResolver(resourceProvider));
 
     return new AnalysisDriver(
         scheduler,
         logger,
-        provider,
+        resourceProvider,
         byteStore,
         contentOverlay,
         null,
-        new SourceFactory(resolvers, null, provider),
+        new SourceFactory(resolvers, null, resourceProvider),
         new AnalysisOptionsImpl()..strongMode = true);
   }
-
-  String _p(String path) => provider.convertPath(path);
 }
diff --git a/pkg/analysis_server/test/src/plugin/plugin_locator_test.dart b/pkg/analysis_server/test/src/plugin/plugin_locator_test.dart
index 38e71a9..db3d3f9 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_locator_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_locator_test.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analysis_server/src/plugin/plugin_locator.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -14,17 +14,14 @@
 }
 
 @reflectiveTest
-class PluginLocatorTest {
-  MemoryResourceProvider resourceProvider;
+class PluginLocatorTest extends Object with ResourceProviderMixin {
   String packageRoot;
   String pubspecPath;
   String defaultDirPath;
   PluginLocator locator;
 
   void setUp() {
-    resourceProvider = new MemoryResourceProvider();
-    packageRoot = resourceProvider.convertPath('/package');
-    resourceProvider.newFolder(packageRoot);
+    packageRoot = newFolder('/package').path;
     locator = new PluginLocator(resourceProvider);
   }
 
@@ -66,25 +63,23 @@
   }
 
   void _createDefaultDir() {
-    defaultDirPath = resourceProvider.pathContext.join(packageRoot,
-        PluginLocator.toolsFolderName, PluginLocator.defaultPluginFolderName);
-    resourceProvider.newFolder(defaultDirPath);
+    defaultDirPath = newFolder(
+            '/package/${PluginLocator.toolsFolderName}/${PluginLocator.defaultPluginFolderName}')
+        .path;
   }
 
   void _createPubspec(String content) {
-    pubspecPath = resourceProvider.pathContext
-        .join(packageRoot, PluginLocator.pubspecFileName);
-    resourceProvider.newFile(pubspecPath, content);
+    pubspecPath =
+        newFile('/package/${PluginLocator.pubspecFileName}', content: content)
+            .path;
   }
 
   String _createPubspecWithKey() {
-    String nonDefaultPath =
-        resourceProvider.pathContext.join(packageRoot, 'pluginDir');
+    String nonDefaultPath = newFolder('/package/pluginDir').path;
     _createPubspec('''
 name: test_project
 ${PluginLocator.analyzerPluginKey}: $nonDefaultPath
 ''');
-    resourceProvider.newFolder(nonDefaultPath);
     return nonDefaultPath;
   }
 
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
index c9665cd..5d3e5b9a 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
@@ -9,9 +9,9 @@
 import 'package:analysis_server/src/plugin/plugin_manager.dart';
 import 'package:analyzer/context/context_root.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/file_system/physical_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:analyzer_plugin/channel/channel.dart';
 import 'package:analyzer_plugin/protocol/protocol.dart';
 import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -105,7 +105,6 @@
 
 @reflectiveTest
 class DiscoveredPluginInfoTest {
-  MemoryResourceProvider resourceProvider;
   TestNotificationManager notificationManager;
   String pluginPath = '/pluginDir';
   String executionPath = '/pluginDir/bin/plugin.dart';
@@ -113,7 +112,6 @@
   DiscoveredPluginInfo plugin;
 
   void setUp() {
-    resourceProvider = new MemoryResourceProvider();
     notificationManager = new TestNotificationManager();
     plugin = new DiscoveredPluginInfo(pluginPath, executionPath, packagesPath,
         notificationManager, InstrumentationService.NULL_SERVICE);
@@ -401,15 +399,13 @@
 }
 
 @reflectiveTest
-class PluginManagerTest {
-  MemoryResourceProvider resourceProvider;
+class PluginManagerTest extends Object with ResourceProviderMixin {
   String byteStorePath;
   String sdkPath;
   TestNotificationManager notificationManager;
   PluginManager manager;
 
   void setUp() {
-    resourceProvider = new MemoryResourceProvider();
     byteStorePath = resourceProvider.convertPath('/byteStore');
     sdkPath = resourceProvider.convertPath('/sdk');
     notificationManager = new TestNotificationManager();
@@ -433,16 +429,13 @@
   }
 
   void test_pathsFor_withPackagesFile() {
-    path.Context context = resourceProvider.pathContext;
     //
     // Build the minimal directory structure for a plugin package that includes
     // a .packages file.
     //
-    String pluginDirPath = resourceProvider.convertPath('/plugin');
-    String pluginFilePath = context.join(pluginDirPath, 'bin', 'plugin.dart');
-    resourceProvider.newFile(pluginFilePath, '');
-    String packagesFilePath = context.join(pluginDirPath, '.packages');
-    resourceProvider.newFile(packagesFilePath, '');
+    String pluginDirPath = newFolder('/plugin').path;
+    String pluginFilePath = newFile('/plugin/bin/plugin.dart').path;
+    String packagesFilePath = newFile('/plugin/.packages').path;
     //
     // Test path computation.
     //
@@ -453,20 +446,17 @@
   }
 
   void test_pathsFor_withPubspec_inBazelWorkspace() {
-    path.Context context = resourceProvider.pathContext;
     //
     // Build a Bazel workspace containing four packages, including the plugin.
     //
-    String rootPath = resourceProvider.convertPath('/workspaceRoot');
-    resourceProvider.newFile(context.join(rootPath, 'WORKSPACE'), '');
-    resourceProvider.newFolder(context.join(rootPath, 'bazel-bin'));
-    resourceProvider.newFolder(context.join(rootPath, 'bazel-genfiles'));
+    newFile('/workspaceRoot/WORKSPACE');
+    newFolder('/workspaceRoot/bazel-bin');
+    newFolder('/workspaceRoot/bazel-genfiles');
 
     String newPackage(String packageName, [List<String> dependencies]) {
       String packageRoot =
-          context.join(rootPath, 'third_party', 'dart', packageName);
-      resourceProvider.newFile(
-          context.join(packageRoot, 'lib', packageName + '.dart'), '');
+          newFolder('/workspaceRoot/third_party/dart/$packageName').path;
+      newFile('$packageRoot/lib/$packageName.dart');
       StringBuffer buffer = new StringBuffer();
       if (dependencies != null) {
         buffer.writeln('dependencies:');
@@ -474,8 +464,7 @@
           buffer.writeln('  $dependency: any');
         }
       }
-      resourceProvider.newFile(
-          context.join(packageRoot, 'pubspec.yaml'), buffer.toString());
+      newFile('$packageRoot/pubspec.yaml', content: buffer.toString());
       return packageRoot;
     }
 
@@ -483,15 +472,14 @@
     newPackage('b', ['d']);
     newPackage('c', ['d']);
     newPackage('d');
-    String pluginFilePath = context.join(pluginDirPath, 'bin', 'plugin.dart');
-    resourceProvider.newFile(pluginFilePath, '');
+    String pluginFilePath = newFile('$pluginDirPath/bin/plugin.dart').path;
     //
     // Test path computation.
     //
     List<String> paths = manager.pathsFor(pluginDirPath);
     expect(paths, hasLength(2));
     expect(paths[0], pluginFilePath);
-    File packagesFile = resourceProvider.getFile(paths[1]);
+    File packagesFile = getFile(paths[1]);
     expect(packagesFile.exists, isTrue);
     String content = packagesFile.readAsStringSync();
     List<String> lines = content.split('\n');
@@ -539,8 +527,7 @@
 }
 
 @reflectiveTest
-class PluginSessionTest {
-  MemoryResourceProvider resourceProvider;
+class PluginSessionTest extends Object with ResourceProviderMixin {
   TestNotificationManager notificationManager;
   String pluginPath;
   String executionPath;
@@ -550,7 +537,6 @@
   PluginSession session;
 
   void setUp() {
-    resourceProvider = new MemoryResourceProvider();
     notificationManager = new TestNotificationManager();
     pluginPath = resourceProvider.convertPath('/pluginDir');
     executionPath = resourceProvider.convertPath('/pluginDir/bin/plugin.dart');
diff --git a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
index 27f99f5..2707c57 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
@@ -17,6 +17,7 @@
 import 'package:analyzer/src/dart/analysis/session.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
 import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:front_end/src/api_prototype/byte_store.dart';
 import 'package:front_end/src/base/performance_logger.dart';
 import 'package:path/path.dart' as path;
@@ -32,29 +33,22 @@
 }
 
 @reflectiveTest
-class PluginWatcherTest {
-  MemoryResourceProvider resourceProvider;
+class PluginWatcherTest extends Object with ResourceProviderMixin {
   TestPluginManager manager;
   PluginWatcher watcher;
 
   void setUp() {
-    resourceProvider = new MemoryResourceProvider();
     manager = new TestPluginManager();
     watcher = new PluginWatcher(resourceProvider, manager);
   }
 
   test_addedDriver() async {
-    String pkg1Path = resourceProvider.convertPath('/pkg1');
-    resourceProvider.newFile(
-        resourceProvider.convertPath('/pkg1/lib/test1.dart'), '');
-    resourceProvider.newFile(
-        resourceProvider.convertPath('/pkg2/lib/pkg2.dart'), '');
-    resourceProvider.newFile(
-        resourceProvider.convertPath('/pkg2/pubspec.yaml'), 'name: pkg2');
-    resourceProvider.newFile(
-        resourceProvider.convertPath(
-            '/pkg2/${PluginLocator.toolsFolderName}/${PluginLocator.defaultPluginFolderName}/bin/plugin.dart'),
-        '');
+    String pkg1Path = newFolder('/pkg1').path;
+    newFile('/pkg1/lib/test1.dart');
+    newFile('/pkg2/lib/pkg2.dart');
+    newFile('/pkg2/pubspec.yaml', content: 'name: pkg2');
+    newFile(
+        '/pkg2/${PluginLocator.toolsFolderName}/${PluginLocator.defaultPluginFolderName}/bin/plugin.dart');
 
     ContextRoot contextRoot = new ContextRoot(pkg1Path, []);
     TestDriver driver = new TestDriver(resourceProvider, contextRoot);
@@ -82,9 +76,8 @@
   }
 
   test_addedDriver_missingPackage() async {
-    String pkg1Path = resourceProvider.convertPath('/pkg1');
-    resourceProvider.newFile(
-        resourceProvider.convertPath('/pkg1/lib/test1.dart'), '');
+    String pkg1Path = newFolder('/pkg1').path;
+    newFile('/pkg1/lib/test1.dart');
 
     ContextRoot contextRoot = new ContextRoot(pkg1Path, []);
     TestDriver driver = new TestDriver(resourceProvider, contextRoot);
@@ -106,7 +99,7 @@
   }
 
   test_removedDriver() {
-    String pkg1Path = resourceProvider.convertPath('/pkg1');
+    String pkg1Path = newFolder('/pkg1').path;
     ContextRoot contextRoot = new ContextRoot(pkg1Path, []);
     TestDriver driver = new TestDriver(resourceProvider, contextRoot);
     watcher.addedDriver(driver, contextRoot);
diff --git a/pkg/analysis_server/test/src/watch_manager_test.dart b/pkg/analysis_server/test/src/watch_manager_test.dart
index 19b72c9..2fe0471 100644
--- a/pkg/analysis_server/test/src/watch_manager_test.dart
+++ b/pkg/analysis_server/test/src/watch_manager_test.dart
@@ -6,7 +6,7 @@
 
 import 'package:analysis_server/src/watch_manager.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 import 'package:watcher/watcher.dart';
@@ -72,67 +72,66 @@
 }
 
 @reflectiveTest
-class WatchManagerTest {
-  MemoryResourceProvider provider;
+class WatchManagerTest extends Object with ResourceProviderMixin {
   WatchListener listener;
   WatchManager<Token> manager;
 
   void setUp() {
-    provider = new MemoryResourceProvider();
     listener = new WatchListener();
-    manager = new WatchManager<Token>(provider, listener.handleWatchEvent);
+    manager =
+        new WatchManager<Token>(resourceProvider, listener.handleWatchEvent);
   }
 
   Future test_addFolder_folderAndSubfolder() async {
-    Folder topFolder = provider.getFolder('/a/b');
-    Folder childFolder = provider.getFolder('/a/b/c/d');
+    Folder topFolder = getFolder('/a/b');
+    Folder childFolder = getFolder('/a/b/c/d');
     Token topToken = new Token('topToken');
     Token childToken = new Token('childToken');
     manager.addFolder(topFolder, topToken);
     manager.addFolder(childFolder, childToken);
 
-    File newFile1 = provider.newFile('/a/b/c/lib.dart', '');
+    File newFile1 = newFile('/a/b/c/lib.dart');
     await _expectEvent(ChangeType.ADD, newFile1.path, [topToken]);
 
-    File newFile2 = provider.newFile('/a/b/c/d/lib.dart', '');
+    File newFile2 = newFile('/a/b/c/d/lib.dart');
     return _expectEvent(ChangeType.ADD, newFile2.path, [topToken, childToken]);
   }
 
   Future test_addFolder_singleFolder_multipleTokens() {
-    Folder folder = provider.getFolder('/a/b');
+    Folder folder = getFolder('/a/b');
     Token token1 = new Token('token1');
     Token token2 = new Token('token2');
     manager.addFolder(folder, token1);
     manager.addFolder(folder, token2);
 
-    File newFile = provider.newFile('/a/b/lib.dart', '');
-    return _expectEvent(ChangeType.ADD, newFile.path, [token1, token2]);
+    File addedFile = newFile('/a/b/lib.dart');
+    return _expectEvent(ChangeType.ADD, addedFile.path, [token1, token2]);
   }
 
   Future test_addFolder_singleFolder_singleToken() async {
-    Folder folder = provider.getFolder('/a/b');
+    Folder folder = getFolder('/a/b');
     Token token = new Token('token');
     manager.addFolder(folder, token);
 
-    Folder newFolder = provider.newFolder('/a/b/c');
-    await _expectEvent(ChangeType.ADD, newFolder.path, [token]);
+    Folder addedFolder = newFolder('/a/b/c');
+    await _expectEvent(ChangeType.ADD, addedFolder.path, [token]);
 
-    File newFile = provider.newFile('/a/b/c/lib.dart', '');
-    return _expectEvent(ChangeType.ADD, newFile.path, [token]);
+    File addedFile = newFile('/a/b/c/lib.dart');
+    return _expectEvent(ChangeType.ADD, addedFile.path, [token]);
   }
 
   Future test_addFolder_unrelatedFolders() async {
-    Folder folder1 = provider.getFolder('/a/b');
-    Folder folder2 = provider.getFolder('/c/d');
+    Folder folder1 = getFolder('/a/b');
+    Folder folder2 = getFolder('/c/d');
     Token token1 = new Token('token1');
     Token token2 = new Token('token2');
     manager.addFolder(folder1, token1);
     manager.addFolder(folder2, token2);
 
-    File newFile1 = provider.newFile('/a/b/lib.dart', '');
+    File newFile1 = newFile('/a/b/lib.dart');
     await _expectEvent(ChangeType.ADD, newFile1.path, [token1]);
 
-    File newFile2 = provider.newFile('/c/d/lib.dart', '');
+    File newFile2 = newFile('/c/d/lib.dart');
     return _expectEvent(ChangeType.ADD, newFile2.path, [token2]);
   }
 
@@ -141,40 +140,40 @@
   }
 
   Future test_removeFolder_multipleTokens() {
-    Folder folder = provider.getFolder('/a/b');
+    Folder folder = getFolder('/a/b');
     Token token1 = new Token('token1');
     Token token2 = new Token('token2');
     manager.addFolder(folder, token1);
     manager.addFolder(folder, token2);
     manager.removeFolder(folder, token2);
 
-    File newFile = provider.newFile('/a/b/lib.dart', '');
-    return _expectEvent(ChangeType.ADD, newFile.path, [token1]);
+    File addedFile = newFile('/a/b/lib.dart');
+    return _expectEvent(ChangeType.ADD, addedFile.path, [token1]);
   }
 
   Future test_removeFolder_withChildren() async {
-    Folder topFolder = provider.getFolder('/a/b');
-    Folder childFolder = provider.getFolder('/a/b/c/d');
+    Folder topFolder = getFolder('/a/b');
+    Folder childFolder = getFolder('/a/b/c/d');
     Token topToken = new Token('topToken');
     Token childToken = new Token('childToken');
     manager.addFolder(topFolder, topToken);
     manager.addFolder(childFolder, childToken);
     manager.removeFolder(topFolder, topToken);
 
-    File newFile = provider.newFile('/a/b/c/d/lib.dart', '');
-    await _expectEvent(ChangeType.ADD, newFile.path, [childToken]);
+    File addedFile = newFile('/a/b/c/d/lib.dart');
+    await _expectEvent(ChangeType.ADD, addedFile.path, [childToken]);
 
-    provider.newFile('/a/b/lib.dart', '');
+    newFile('/a/b/lib.dart');
     return _expectNoEvent();
   }
 
   Future test_removeFolder_withNoChildren() {
-    Folder folder = provider.getFolder('/a/b');
+    Folder folder = getFolder('/a/b');
     Token token = new Token('token');
     manager.addFolder(folder, token);
     manager.removeFolder(folder, token);
 
-    provider.newFile('/a/b/lib.dart', '');
+    newFile('/a/b/lib.dart');
     return _expectNoEvent();
   }
 
@@ -197,11 +196,9 @@
 }
 
 @reflectiveTest
-class WatchNodeTest {
-  MemoryResourceProvider provider = new MemoryResourceProvider();
-
+class WatchNodeTest extends Object with ResourceProviderMixin {
   void test_creation_folder() {
-    Folder folder = provider.getFolder('/a/b');
+    Folder folder = getFolder('/a/b');
     WatchNode node = new WatchNode(folder);
     expect(node, isNotNull);
     expect(node.children, isEmpty);
@@ -223,9 +220,9 @@
 
   void test_delete_nested_child() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
-    WatchNode grandchildNode = new WatchNode(provider.getFolder('/a/b/c/d/e'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
+    WatchNode grandchildNode = new WatchNode(getFolder('/a/b/c/d/e'));
     rootNode.insert(topNode);
     rootNode.insert(childNode);
     rootNode.insert(grandchildNode);
@@ -239,8 +236,8 @@
 
   void test_delete_nested_noChild() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
     rootNode.insert(topNode);
     rootNode.insert(childNode);
 
@@ -252,8 +249,8 @@
 
   void test_delete_top_child() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
     rootNode.insert(topNode);
     rootNode.insert(childNode);
 
@@ -264,7 +261,7 @@
 
   void test_delete_top_noChild() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
     rootNode.insert(topNode);
 
     topNode.delete();
@@ -273,7 +270,7 @@
 
   void test_findParent_childOfLeaf() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
     rootNode.insert(topNode);
 
     expect(rootNode.findParent('/a/b/c'), topNode);
@@ -281,8 +278,8 @@
 
   void test_findParent_childOfNonLeaf() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
     rootNode.insert(topNode);
     rootNode.insert(childNode);
 
@@ -291,7 +288,7 @@
 
   void test_findParent_noMatch() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
     rootNode.insert(topNode);
 
     expect(rootNode.findParent('/c/d'), rootNode);
@@ -299,9 +296,9 @@
 
   void test_insert_intermediate_afterParentAndChild() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
-    WatchNode intermediateNode = new WatchNode(provider.getFolder('/a/b/c'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
+    WatchNode intermediateNode = new WatchNode(getFolder('/a/b/c'));
 
     rootNode.insert(topNode);
     rootNode.insert(childNode);
@@ -316,8 +313,8 @@
 
   void test_insert_nested_afterParent() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
 
     rootNode.insert(topNode);
     rootNode.insert(childNode);
@@ -328,8 +325,8 @@
 
   void test_insert_nested_beforeParent() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
-    WatchNode childNode = new WatchNode(provider.getFolder('/a/b/c/d'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
+    WatchNode childNode = new WatchNode(getFolder('/a/b/c/d'));
 
     rootNode.insert(childNode);
     rootNode.insert(topNode);
@@ -340,7 +337,7 @@
 
   void test_insert_top() {
     WatchNode rootNode = new WatchNode(null);
-    WatchNode topNode = new WatchNode(provider.getFolder('/a/b'));
+    WatchNode topNode = new WatchNode(getFolder('/a/b'));
 
     rootNode.insert(topNode);
     expect(rootNode.children, equals([topNode]));