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

Side by Side Diff: utils/tests/pub/test_pub.dart

Issue 11464006: Stop working around issue 6984. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « utils/tests/pub/pub_lish_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 _server = new HttpServer(); 101 _server = new HttpServer();
102 _server.defaultRequestHandler = (request, response) { 102 _server.defaultRequestHandler = (request, response) {
103 var path = request.uri.replaceFirst("/", "").split("/"); 103 var path = request.uri.replaceFirst("/", "").split("/");
104 response.persistentConnection = false; 104 response.persistentConnection = false;
105 var stream; 105 var stream;
106 try { 106 try {
107 stream = baseDir.load(path); 107 stream = baseDir.load(path);
108 } catch (e) { 108 } catch (e) {
109 response.statusCode = 404; 109 response.statusCode = 404;
110 response.contentLength = 0; 110 response.contentLength = 0;
111 closeHttpResponse(request, response); 111 response.outputStream.close();
112 return; 112 return;
113 } 113 }
114 114
115 var future = consumeInputStream(stream); 115 var future = consumeInputStream(stream);
116 future.then((data) { 116 future.then((data) {
117 response.statusCode = 200; 117 response.statusCode = 200;
118 response.contentLength = data.length; 118 response.contentLength = data.length;
119 response.outputStream.write(data); 119 response.outputStream.write(data);
120 closeHttpResponse(request, response); 120 response.outputStream.close();
121 }); 121 });
122 122
123 future.handleException((e) { 123 future.handleException((e) {
124 print("Exception while handling ${request.uri}: $e"); 124 print("Exception while handling ${request.uri}: $e");
125 response.statusCode = 500; 125 response.statusCode = 500;
126 response.reasonPhrase = e.message; 126 response.reasonPhrase = e.message;
127 closeHttpResponse(request, response); 127 response.outputStream.close();
128 }); 128 });
129 }; 129 };
130 _server.listen("127.0.0.1", 0); 130 _server.listen("127.0.0.1", 0);
131 _portCompleter.complete(_server.port); 131 _portCompleter.complete(_server.port);
132 _scheduleCleanup((_) => _closeServer()); 132 _scheduleCleanup((_) => _closeServer());
133 return null; 133 return null;
134 }); 134 });
135 }); 135 });
136 } 136 }
137 137
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 /// calling [completion] is unnecessary. 1630 /// calling [completion] is unnecessary.
1631 void expectLater(Future actual, matcher, {String reason, 1631 void expectLater(Future actual, matcher, {String reason,
1632 FailureHandler failureHandler, bool verbose: false}) { 1632 FailureHandler failureHandler, bool verbose: false}) {
1633 _schedule((_) { 1633 _schedule((_) {
1634 return actual.transform((value) { 1634 return actual.transform((value) {
1635 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1635 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1636 verbose: false); 1636 verbose: false);
1637 }); 1637 });
1638 }); 1638 });
1639 } 1639 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pub_lish_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698