anchor.diff:      name = '$name, with mocks';
     }
   
  -  test(name, () {
  +  test(name, () async {
       // see subsequent access to this expando below
       _isMockTestExpando[currentTestCase] = useMocks;
   
       var dir = Directory.systemTemp.createTempSync('http_server_virtual_');
   
  -    return func(dir).whenComplete(() {
  -      return dir.delete(recursive: true);
  -    });
  +    try {
  +      await func(dir);
  +    } finally {
  +      await dir.delete(recursive: true);
  +    }
     });
   }
   
  
positive.code: }
  
  Future<MockHttpResponse> _withMockRequest(
      VirtualDirectory virDir, MockHttpRequest request) {
    return virDir.serveRequest(request).then((value) {
      expect(value, isNull);
      expect(request.response.mockDone, isTrue);
      return request.response;
    }).then((HttpResponse response) {
      if (response.statusCode == HttpStatus.MOVED_PERMANENTLY ||
          response.statusCode == HttpStatus.MOVED_TEMPORARILY) {
        if (request.followRedirects == true) {
          var uri = Uri.parse(response.headers.value(HttpHeaders.LOCATION));
          var newMock = new MockHttpRequest(uri, followRedirects: true);
  
          return _withMockRequest(virDir, newMock);
        }
      }
      return response as MockHttpResponse;
    });
  }
  
  Future _withServer(VirtualDirectory virDir, Future func(int port)) {
    HttpServer server;
    return HttpServer.bind('localhost', 0).then((value) {
      server = value;
      virDir.serve(server);
      return func(server.port);
    }).whenComplete(() => server.close());
  }
  
  Future<HttpHeaders> _getHeaders(int port, String path, int from, int to) {
  
negative.code:       return response.mockContent;
      });
    }
  
    assert(_isMockTestExpando[currentTestCase] == false);
  
  