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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/serve/utils.dart

Issue 704053002: Fix dart2js tests in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub_tests; 5 library pub_tests;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 249
250 /// Schedules an HTTP request to the running pub server with [urlPath] and 250 /// Schedules an HTTP request to the running pub server with [urlPath] and
251 /// verifies that it responds with a body that matches [expectation]. 251 /// verifies that it responds with a body that matches [expectation].
252 /// 252 ///
253 /// [expectation] may either be a [Matcher] or a string to match an exact body. 253 /// [expectation] may either be a [Matcher] or a string to match an exact body.
254 /// [root] indicates which server should be accessed, and defaults to "web". 254 /// [root] indicates which server should be accessed, and defaults to "web".
255 /// [headers] may be either a [Matcher] or a map to match an exact headers map. 255 /// [headers] may be either a [Matcher] or a map to match an exact headers map.
256 void requestShouldSucceed(String urlPath, expectation, {String root, headers}) { 256 void requestShouldSucceed(String urlPath, expectation, {String root, headers}) {
257 scheduleRequest(urlPath, root: root).then((response) { 257 scheduleRequest(urlPath, root: root).then((response) {
258 expect(response.statusCode, equals(200));
258 if (expectation != null) expect(response.body, expectation); 259 if (expectation != null) expect(response.body, expectation);
259 if (headers != null) expect(response.headers, headers); 260 if (headers != null) expect(response.headers, headers);
260 }); 261 });
261 } 262 }
262 263
263 /// Schedules an HTTP request to the running pub server with [urlPath] and 264 /// Schedules an HTTP request to the running pub server with [urlPath] and
264 /// verifies that it responds with a 404. 265 /// verifies that it responds with a 404.
265 /// 266 ///
266 /// [root] indicates which server should be accessed, and defaults to "web". 267 /// [root] indicates which server should be accessed, and defaults to "web".
267 void requestShould404(String urlPath, {String root}) { 268 void requestShould404(String urlPath, {String root}) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 /// included. Unlike [getServerUrl], this should only be called after the ports 482 /// included. Unlike [getServerUrl], this should only be called after the ports
482 /// are known. 483 /// are known.
483 String _getServerUrlSync([String root, String path]) { 484 String _getServerUrlSync([String root, String path]) {
484 if (root == null) root = 'web'; 485 if (root == null) root = 'web';
485 expect(_ports, contains(root)); 486 expect(_ports, contains(root));
486 var url = "http://localhost:${_ports[root]}"; 487 var url = "http://localhost:${_ports[root]}";
487 if (path != null) url = "$url/$path"; 488 if (path != null) url = "$url/$path";
488 return url; 489 return url;
489 } 490 }
490 491
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698