misc: move to pkg:test, stop using deprecated APIs

Skip three tests that require refactoring for pkg:test
Remove dependency on pkg:collection
diff --git a/.analysis_options b/.analysis_options
deleted file mode 100644
index a10d4c5..0000000
--- a/.analysis_options
+++ /dev/null
@@ -1,2 +0,0 @@
-analyzer:
-  strong-mode: true
diff --git a/.gitignore b/.gitignore
index 7dbf035..ac98e87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,4 @@
 # Don’t commit the following directories created by pub.
-.buildlog
-.pub/
-build/
-packages
+.dart_tool
 .packages
-
-# Or the files created by dart2js.
-*.dart.js
-*.js_
-*.js.deps
-*.js.map
-
-# Include when developing application packages.
-pubspec.lock
\ No newline at end of file
+pubspec.lock
diff --git a/.status b/.status
deleted file mode 100644
index 8e10eb2..0000000
--- a/.status
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-# 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.
-
-# Skip non-test files ending with "_test".
-packages/*: Skip
-*/packages/*: Skip
-*/*/packages/*: Skip
-*/*/*/packages/*: Skip
-*/*/*/*packages/*: Skip
-*/*/*/*/*packages/*: Skip
-
-# Only run tests from the build directory, since we don't care about the
-# difference between transformed an untransformed code.
-test/*: Skip
-
-[ $browser ]
-build/test/io/*: Fail, OK # Uses dart:io.
-
-[ $runtime == vm ]
-build/test/html/*: Skip # Uses dart:html.
-
-[ $runtime == drt ]
-build/test/html/client_test: Skip # Issue 18566
-
diff --git a/.test_config b/.test_config
new file mode 100644
index 0000000..412fc5c
--- /dev/null
+++ b/.test_config
@@ -0,0 +1,3 @@
+{
+  "test_package": true
+}
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..cfc0906
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,20 @@
+language: dart
+
+dart:
+  - dev
+  - stable
+
+dart_task:
+  - test: --platform vm
+  # No parallelism on Firefox (-j 1)
+  # Causes flakiness – need to investigate
+  - test: --platform firefox -j 1
+  - dartanalyzer
+
+# Only building master means that we don't run two builds for each pull request.
+branches:
+  only: [master]
+
+cache:
+ directories:
+   - $HOME/.pub-cache
diff --git a/codereview.settings b/codereview.settings
deleted file mode 100644
index f980465..0000000
--- a/codereview.settings
+++ /dev/null
@@ -1,3 +0,0 @@
-CODE_REVIEW_SERVER: http://codereview.chromium.org/
-VIEW_VC: https://github.com/dart-lang/http/commit/
-CC_LIST: reviews@dartlang.org
\ No newline at end of file
diff --git a/lib/src/base_client.dart b/lib/src/base_client.dart
index 842d114..2a1f246 100644
--- a/lib/src/base_client.dart
+++ b/lib/src/base_client.dart
@@ -6,8 +6,6 @@
 import 'dart:convert';
 import 'dart:typed_data';
 
-import 'package:collection/collection.dart';
-
 import 'base_request.dart';
 import 'client.dart';
 import 'exception.dart';
@@ -160,9 +158,9 @@
       if (body is String) {
         request.body = body;
       } else if (body is List) {
-        request.bodyBytes = DelegatingList.typed(body);
+        request.bodyBytes = body.cast<int>();
       } else if (body is Map) {
-        request.bodyFields = DelegatingMap.typed(body);
+        request.bodyFields = body.cast<String, String>();
       } else {
         throw new ArgumentError('Invalid request body "$body".');
       }
diff --git a/pubspec.yaml b/pubspec.yaml
index 8adb27f..36be5ad 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,14 +1,16 @@
 name: http
-version: 0.11.3+17
+version: 0.11.4-dev
 author: "Dart Team <misc@dartlang.org>"
 homepage: https://github.com/dart-lang/http
 description: A composable, Future-based API for making HTTP requests.
-dependencies:
-  async: ">=1.10.0 <3.0.0"
-  collection: "^1.5.0"
-  http_parser: ">=0.0.1 <4.0.0"
-  path: ">=0.9.0 <2.0.0"
-dev_dependencies:
-  unittest: ">=0.9.0 <0.12.0"
+
 environment:
   sdk: ">=2.0.0-dev.61.0 <3.0.0"
+
+dependencies:
+  async: ">=1.10.0 <3.0.0"
+  http_parser: ">=0.0.1 <4.0.0"
+  path: ">=0.9.0 <2.0.0"
+
+dev_dependencies:
+  test: ^1.3.0
diff --git a/test/html/client_test.dart b/test/html/client_test.dart
index 47ad714..6fb2c62 100644
--- a/test/html/client_test.dart
+++ b/test/html/client_test.dart
@@ -2,9 +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.
 
+@TestOn('browser')
+
 import 'package:http/http.dart' as http;
 import 'package:http/browser_client.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
@@ -21,7 +23,7 @@
 
     request.sink.add('{"hello": "world"}'.codeUnits);
     request.sink.close();
-  });
+  }, skip: 'Need to fix server tests for browser');
 
   test('#send with an invalid URL', () {
     var client = new BrowserClient();
diff --git a/test/html/streamed_request_test.dart b/test/html/streamed_request_test.dart
index 6496f4b..662c3ba 100644
--- a/test/html/streamed_request_test.dart
+++ b/test/html/streamed_request_test.dart
@@ -2,9 +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.
 
+@TestOn('browser')
+
 import 'package:http/http.dart' as http;
 import 'package:http/browser_client.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
@@ -32,5 +34,5 @@
             completion(equals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])));
       });
     });
-  });
+  }, skip: 'Need to fix server tests for browser');
 }
diff --git a/test/io/client_test.dart b/test/io/client_test.dart
index 8fd3007..410a875 100644
--- a/test/io/client_test.dart
+++ b/test/io/client_test.dart
@@ -2,10 +2,12 @@
 // 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.
 
+@TestOn('vm')
+
 import 'dart:io';
 
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
@@ -17,9 +19,9 @@
         startServer().then((_) {
           var client = new http.Client();
           var request = new http.StreamedRequest("POST", serverUrl);
-          request.headers[HttpHeaders.contentType] =
+          request.headers[HttpHeaders.contentTypeHeader] =
               'application/json; charset=utf-8';
-          request.headers[HttpHeaders.userAgent] = 'Dart';
+          request.headers[HttpHeaders.userAgentHeader] = 'Dart';
 
           expect(
               client.send(request).then((response) {
@@ -56,9 +58,9 @@
           var ioClient = new HttpClient();
           var client = new http.IOClient(ioClient);
           var request = new http.StreamedRequest("POST", serverUrl);
-          request.headers[HttpHeaders.contentType] =
+          request.headers[HttpHeaders.contentTypeHeader] =
               'application/json; charset=utf-8';
-          request.headers[HttpHeaders.userAgent] = 'Dart';
+          request.headers[HttpHeaders.userAgentHeader] = 'Dart';
 
           expect(
               client.send(request).then((response) {
@@ -95,7 +97,7 @@
           var client = new http.Client();
           var url = Uri.parse('http://http.invalid');
           var request = new http.StreamedRequest("POST", url);
-          request.headers[HttpHeaders.contentType] =
+          request.headers[HttpHeaders.contentTypeHeader] =
               'application/json; charset=utf-8';
 
           expect(client.send(request), throwsSocketException);
diff --git a/test/io/http_test.dart b/test/io/http_test.dart
index f122069..9eab1a7 100644
--- a/test/io/http_test.dart
+++ b/test/io/http_test.dart
@@ -2,8 +2,10 @@
 // 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.
 
+@TestOn('vm')
+
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/io/multipart_test.dart b/test/io/multipart_test.dart
index dd75210..58dbe36 100644
--- a/test/io/multipart_test.dart
+++ b/test/io/multipart_test.dart
@@ -2,12 +2,14 @@
 // 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.
 
+@TestOn('vm')
+
 import 'dart:async';
 import 'dart:io';
 
 import 'package:http/http.dart' as http;
 import 'package:path/path.dart' as path;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/io/request_test.dart b/test/io/request_test.dart
index 4c8d74a..3b2d7e0 100644
--- a/test/io/request_test.dart
+++ b/test/io/request_test.dart
@@ -2,8 +2,10 @@
 // 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.
 
+@TestOn('vm')
+
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/io/streamed_request_test.dart b/test/io/streamed_request_test.dart
index f172dc3..6609080 100644
--- a/test/io/streamed_request_test.dart
+++ b/test/io/streamed_request_test.dart
@@ -2,10 +2,12 @@
 // 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.
 
+@TestOn('vm')
+
 import 'dart:convert';
 
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/io/utils.dart b/test/io/utils.dart
index b7b4cd4..56d1b22 100644
--- a/test/io/utils.dart
+++ b/test/io/utils.dart
@@ -8,7 +8,7 @@
 
 import 'package:http/http.dart';
 import 'package:http/src/utils.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 export '../utils.dart';
 
@@ -117,31 +117,16 @@
 
 /// A matcher for functions that throw HttpException.
 Matcher get throwsClientException =>
-    throwsA(new isInstanceOf<ClientException>());
+    throwsA(new TypeMatcher<ClientException>());
 
 /// A matcher for RedirectLimitExceededExceptions.
-const isRedirectLimitExceededException =
-    const _RedirectLimitExceededException();
+final isRedirectLimitExceededException = const TypeMatcher<RedirectException>()
+    .having((e) => e.message, 'message', 'Redirect limit exceeded');
 
 /// A matcher for functions that throw RedirectLimitExceededException.
-const Matcher throwsRedirectLimitExceededException =
-    const Throws(isRedirectLimitExceededException);
-
-class _RedirectLimitExceededException extends TypeMatcher {
-  const _RedirectLimitExceededException()
-      : super("RedirectLimitExceededException");
-
-  bool matches(item, Map matchState) =>
-      item is RedirectException && item.message == "Redirect limit exceeded";
-}
-
-/// A matcher for SocketExceptions.
-const isSocketException = const _SocketException();
+final Matcher throwsRedirectLimitExceededException =
+    throwsA(isRedirectLimitExceededException);
 
 /// A matcher for functions that throw SocketException.
-const Matcher throwsSocketException = const Throws(isSocketException);
-
-class _SocketException extends TypeMatcher {
-  const _SocketException() : super("SocketException");
-  bool matches(item, Map matchState) => item is SocketException;
-}
+final Matcher throwsSocketException =
+    throwsA(const TypeMatcher<SocketException>());
diff --git a/test/mock_client_test.dart b/test/mock_client_test.dart
index 31ddb26..ff0504d 100644
--- a/test/mock_client_test.dart
+++ b/test/mock_client_test.dart
@@ -7,7 +7,7 @@
 
 import 'package:http/http.dart' as http;
 import 'package:http/testing.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/multipart_test.dart b/test/multipart_test.dart
index 0fdf093..1f67116 100644
--- a/test/multipart_test.dart
+++ b/test/multipart_test.dart
@@ -7,7 +7,7 @@
 import 'package:http/http.dart' as http;
 import 'package:http/src/boundary_characters.dart';
 import 'package:http_parser/http_parser.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
@@ -192,7 +192,7 @@
 
   test('with a stream file', () {
     var request = new http.MultipartRequest('POST', dummyUrl);
-    var controller = new StreamController(sync: true);
+    var controller = new StreamController<List<int>>(sync: true);
     request.files.add(new http.MultipartFile('file', controller.stream, 5));
 
     expect(request, bodyMatches('''
@@ -210,7 +210,7 @@
 
   test('with an empty stream file', () {
     var request = new http.MultipartRequest('POST', dummyUrl);
-    var controller = new StreamController(sync: true);
+    var controller = new StreamController<List<int>>(sync: true);
     request.files.add(new http.MultipartFile('file', controller.stream, 0));
 
     expect(request, bodyMatches('''
diff --git a/test/request_test.dart b/test/request_test.dart
index 6f59054..3fc8967 100644
--- a/test/request_test.dart
+++ b/test/request_test.dart
@@ -5,7 +5,7 @@
 import 'dart:convert';
 
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/response_test.dart b/test/response_test.dart
index 066cd66..44707bf 100644
--- a/test/response_test.dart
+++ b/test/response_test.dart
@@ -5,7 +5,7 @@
 import 'dart:async';
 
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 void main() {
   group('()', () {
@@ -49,7 +49,7 @@
 
   group('.fromStream()', () {
     test('sets body', () {
-      var controller = new StreamController(sync: true);
+      var controller = new StreamController<List<int>>(sync: true);
       var streamResponse =
           new http.StreamedResponse(controller.stream, 200, contentLength: 13);
       var future = http.Response.fromStream(streamResponse)
@@ -62,7 +62,7 @@
     });
 
     test('sets bodyBytes', () {
-      var controller = new StreamController(sync: true);
+      var controller = new StreamController<List<int>>(sync: true);
       var streamResponse =
           new http.StreamedResponse(controller.stream, 200, contentLength: 5);
       var future = http.Response.fromStream(streamResponse)
diff --git a/test/streamed_request_test.dart b/test/streamed_request_test.dart
index c7e56e2..6a86fcb 100644
--- a/test/streamed_request_test.dart
+++ b/test/streamed_request_test.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:http/http.dart' as http;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 import 'utils.dart';
 
diff --git a/test/utils.dart b/test/utils.dart
index cc2914b..c9819c6 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -6,7 +6,7 @@
 
 import 'package:http/http.dart' as http;
 import 'package:http_parser/http_parser.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
 
 /// A dummy URL for constructing requests that won't be sent.
 Uri get dummyUrl => Uri.parse('http://dartlang.org/');
@@ -105,7 +105,7 @@
 ///
 /// [message] can be a String or a [Matcher].
 Matcher isClientException(message) => predicate((error) {
-      expect(error, new isInstanceOf<http.ClientException>());
+      expect(error, new TypeMatcher<http.ClientException>());
       expect(error.message, message);
       return true;
     });