Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: pkg/http/test/mock_client_test.dart

Issue 810223002: Remove the http package from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/http/test/mock_client_test.dart
diff --git a/pkg/http/test/mock_client_test.dart b/pkg/http/test/mock_client_test.dart
deleted file mode 100644
index 5c1cbf0e8f544ebb1b28729020414a23ae062208..0000000000000000000000000000000000000000
--- a/pkg/http/test/mock_client_test.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2012, 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.
-
-library mock_client_test;
-
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:http/http.dart' as http;
-import 'package:http/src/utils.dart';
-import 'package:http/testing.dart';
-import 'package:unittest/unittest.dart';
-
-import 'utils.dart';
-
-void main() {
- test('handles a request', () {
- var client = new MockClient((request) {
- return new Future.value(new http.Response(
- JSON.encode(request.bodyFields), 200,
- request: request, headers: {'content-type': 'application/json'}));
- });
-
- expect(client.post("http://example.com/foo", body: {
- 'field1': 'value1',
- 'field2': 'value2'
- }).then((response) => response.body), completion(parse(equals({
- 'field1': 'value1',
- 'field2': 'value2'
- }))));
- });
-
- test('handles a streamed request', () {
- var client = new MockClient.streaming((request, bodyStream) {
- return bodyStream.bytesToString().then((bodyString) {
- var controller = new StreamController<List<int>>(sync: true);
- async.then((_) {
- controller.add('Request body was "$bodyString"'.codeUnits);
- controller.close();
- });
-
- return new http.StreamedResponse(controller.stream, 200);
- });
- });
-
- var uri = Uri.parse("http://example.com/foo");
- var request = new http.Request("POST", uri);
- request.body = "hello, world";
- var future = client.send(request)
- .then(http.Response.fromStream)
- .then((response) => response.body);
- expect(future, completion(equals('Request body was "hello, world"')));
- });
-
- test('handles a request with no body', () {
- var client = new MockClient((request) {
- return new Future.value(new http.Response('you did it', 200));
- });
-
- expect(client.read("http://example.com/foo"),
- completion(equals('you did it')));
- });
-}
« no previous file with comments | « pkg/http/test/io/utils.dart ('k') | pkg/http/test/multipart_test.dart » ('j') | pkg/pkg.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698