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

Side by Side Diff: sdk/lib/_internal/pub/test/test_pub.dart

Issue 14701007: Update pub usage of '127.0.0.1'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months 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 | « sdk/lib/_internal/pub/lib/src/safe_http_server.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub
6 /// tests are integration tests that stage some stuff on the file system, run 6 /// tests are integration tests that stage some stuff on the file system, run
7 /// pub, and then validate the results. This library provides an API to build 7 /// pub, and then validate the results. This library provides an API to build
8 /// tests like that. 8 /// tests like that.
9 library test_pub; 9 library test_pub;
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 /// Creates an HTTP server to serve [contents] as static files. This server will 90 /// Creates an HTTP server to serve [contents] as static files. This server will
91 /// exist only for the duration of the pub run. 91 /// exist only for the duration of the pub run.
92 /// 92 ///
93 /// Subsequent calls to [serve] will replace the previous server. 93 /// Subsequent calls to [serve] will replace the previous server.
94 void serve([List<d.Descriptor> contents]) { 94 void serve([List<d.Descriptor> contents]) {
95 var baseDir = d.dir("serve-dir", contents); 95 var baseDir = d.dir("serve-dir", contents);
96 96
97 schedule(() { 97 schedule(() {
98 return _closeServer().then((_) { 98 return _closeServer().then((_) {
99 return SafeHttpServer.bind("127.0.0.1", 0).then((server) { 99 return SafeHttpServer.bind("localhost", 0).then((server) {
100 _server = server; 100 _server = server;
101 server.listen((request) { 101 server.listen((request) {
102 var response = request.response; 102 var response = request.response;
103 try { 103 try {
104 var path = request.uri.path.replaceFirst("/", ""); 104 var path = request.uri.path.replaceFirst("/", "");
105 105
106 if (_requestedPaths == null) _requestedPaths = <String>[]; 106 if (_requestedPaths == null) _requestedPaths = <String>[];
107 _requestedPaths.add(path); 107 _requestedPaths.add(path);
108 108
109 response.persistentConnection = false; 109 response.persistentConnection = false;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 bool matches(item, MatchState matchState) { 611 bool matches(item, MatchState matchState) {
612 if (item is! Pair) return false; 612 if (item is! Pair) return false;
613 return _firstMatcher.matches(item.first, matchState) && 613 return _firstMatcher.matches(item.first, matchState) &&
614 _lastMatcher.matches(item.last, matchState); 614 _lastMatcher.matches(item.last, matchState);
615 } 615 }
616 616
617 Description describe(Description description) { 617 Description describe(Description description) {
618 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); 618 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
619 } 619 }
620 } 620 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/safe_http_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698