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

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

Issue 311253005: Bind to all available loopback addresses in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 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/test/serve/web_socket/serve_directory_test.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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return shelf_io.serve((request) { 163 return shelf_io.serve((request) {
164 currentSchedule.heartbeat(); 164 currentSchedule.heartbeat();
165 var path = request.url.path.replaceFirst("/", ""); 165 var path = request.url.path.replaceFirst("/", "");
166 _requestedPaths.add(path); 166 _requestedPaths.add(path);
167 167
168 return validateStream(baseDir.load(path)) 168 return validateStream(baseDir.load(path))
169 .then((stream) => new shelf.Response.ok(stream)) 169 .then((stream) => new shelf.Response.ok(stream))
170 .catchError((error) { 170 .catchError((error) {
171 return new shelf.Response.notFound('File "$path" not found.'); 171 return new shelf.Response.notFound('File "$path" not found.');
172 }); 172 });
173 }, '127.0.0.1', 0).then((server) { 173 }, 'localhost', 0).then((server) {
174 _server = server; 174 _server = server;
175 _portCompleter.complete(_server.port); 175 _portCompleter.complete(_server.port);
176 currentSchedule.onComplete.schedule(_closeServer); 176 currentSchedule.onComplete.schedule(_closeServer);
177 }); 177 });
178 }); 178 });
179 }, 'starting a server serving:\n${baseDir.describe()}'); 179 }, 'starting a server serving:\n${baseDir.describe()}');
180 } 180 }
181 181
182 /// Closes [_server]. Returns a [Future] that will complete after the [_server] 182 /// Closes [_server]. Returns a [Future] that will complete after the [_server]
183 /// is closed. 183 /// is closed.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 if (tokenEndpoint != null) { 529 if (tokenEndpoint != null) {
530 environment['_PUB_TEST_TOKEN_ENDPOINT'] = 530 environment['_PUB_TEST_TOKEN_ENDPOINT'] =
531 tokenEndpoint.toString(); 531 tokenEndpoint.toString();
532 } 532 }
533 533
534 // If there is a server running, tell pub what its URL is so hosted 534 // If there is a server running, tell pub what its URL is so hosted
535 // dependencies will look there. 535 // dependencies will look there.
536 if (_hasServer) { 536 if (_hasServer) {
537 return port.then((p) { 537 return port.then((p) {
538 environment['PUB_HOSTED_URL'] = "http://127.0.0.1:$p"; 538 environment['PUB_HOSTED_URL'] = "http://localhost:$p";
539 return environment; 539 return environment;
540 }); 540 });
541 } 541 }
542 542
543 return environment; 543 return environment;
544 }); 544 });
545 545
546 return new PubProcess.start(dartBin, dartArgs, environment: environmentFuture, 546 return new PubProcess.start(dartBin, dartArgs, environment: environmentFuture,
547 workingDirectory: pathInSandbox(appPath), 547 workingDirectory: pathInSandbox(appPath),
548 description: args.isEmpty ? 'pub' : 'pub ${args.first}'); 548 description: args.isEmpty ? 'pub' : 'pub ${args.first}');
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 _lastMatcher.matches(item.last, matchState); 909 _lastMatcher.matches(item.last, matchState);
910 } 910 }
911 911
912 Description describe(Description description) { 912 Description describe(Description description) {
913 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); 913 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
914 } 914 }
915 } 915 }
916 916
917 /// A [StreamMatcher] that matches multiple lines of output. 917 /// A [StreamMatcher] that matches multiple lines of output.
918 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); 918 StreamMatcher emitsLines(String output) => inOrder(output.split("\n"));
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698