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

Side by Side Diff: pkg/shelf/test/test_util.dart

Issue 814113004: Pull args, intl, logging, shelf, and source_maps out of the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also csslib. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/shelf/test/shelf_io_test.dart ('k') | pkg/source_maps/CHANGELOG.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library shelf.test_util;
6
7 import 'dart:async';
8
9 import 'package:shelf/shelf.dart';
10 import 'package:shelf/src/util.dart';
11
12 // "hello,"
13 const HELLO_BYTES = const [104, 101, 108, 108, 111, 44];
14
15 // " world"
16 const WORLD_BYTES = const [32, 119, 111, 114, 108, 100];
17
18 /// A simple, synchronous handler for [Request].
19 ///
20 /// By default, replies with a status code 200, empty headers, and
21 /// `Hello from ${request.url.path}`.
22 Response syncHandler(Request request, {int statusCode,
23 Map<String, String> headers}) {
24 if (statusCode == null) statusCode = 200;
25 return new Response(statusCode, headers: headers,
26 body: 'Hello from ${request.url.path}');
27 }
28
29 /// Calls [syncHandler] and wraps the response in a [Future].
30 Future<Response> asyncHandler(Request request) =>
31 new Future(() => syncHandler(request));
32
33 /// Makes a simple GET request to [handler] and returns the result.
34 Future<Response> makeSimpleRequest(Handler handler) =>
35 syncFuture(() => handler(_request));
36
37 final _request = new Request('GET', LOCALHOST_URI);
38
39 final LOCALHOST_URI = Uri.parse('http://localhost/');
OLDNEW
« no previous file with comments | « pkg/shelf/test/shelf_io_test.dart ('k') | pkg/source_maps/CHANGELOG.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698