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

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

Issue 11528005: Reapply "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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 _server = new HttpServer(); 102 _server = new HttpServer();
103 _server.defaultRequestHandler = (request, response) { 103 _server.defaultRequestHandler = (request, response) {
104 var path = request.uri.replaceFirst("/", "").split("/"); 104 var path = request.uri.replaceFirst("/", "").split("/");
105 response.persistentConnection = false; 105 response.persistentConnection = false;
106 var stream; 106 var stream;
107 try { 107 try {
108 stream = baseDir.load(path); 108 stream = baseDir.load(path);
109 } catch (e) { 109 } catch (e) {
110 response.statusCode = 404; 110 response.statusCode = 404;
111 response.contentLength = 0; 111 response.contentLength = 0;
112 closeHttpResponse(request, response); 112 response.outputStream.close();
113 return; 113 return;
114 } 114 }
115 115
116 var future = consumeInputStream(stream); 116 var future = consumeInputStream(stream);
117 future.then((data) { 117 future.then((data) {
118 response.statusCode = 200; 118 response.statusCode = 200;
119 response.contentLength = data.length; 119 response.contentLength = data.length;
120 response.outputStream.write(data); 120 response.outputStream.write(data);
121 closeHttpResponse(request, response); 121 response.outputStream.close();
122 }); 122 });
123 123
124 future.handleException((e) { 124 future.handleException((e) {
125 print("Exception while handling ${request.uri}: $e"); 125 print("Exception while handling ${request.uri}: $e");
126 response.statusCode = 500; 126 response.statusCode = 500;
127 response.reasonPhrase = e.message; 127 response.reasonPhrase = e.message;
128 closeHttpResponse(request, response); 128 response.outputStream.close();
129 }); 129 });
130 }; 130 };
131 _server.listen("127.0.0.1", 0); 131 _server.listen("127.0.0.1", 0);
132 _portCompleter.complete(_server.port); 132 _portCompleter.complete(_server.port);
133 _scheduleCleanup((_) => _closeServer()); 133 _scheduleCleanup((_) => _closeServer());
134 return null; 134 return null;
135 }); 135 });
136 }); 136 });
137 } 137 }
138 138
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 /// calling [completion] is unnecessary. 1632 /// calling [completion] is unnecessary.
1633 void expectLater(Future actual, matcher, {String reason, 1633 void expectLater(Future actual, matcher, {String reason,
1634 FailureHandler failureHandler, bool verbose: false}) { 1634 FailureHandler failureHandler, bool verbose: false}) {
1635 _schedule((_) { 1635 _schedule((_) {
1636 return actual.transform((value) { 1636 return actual.transform((value) {
1637 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1637 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1638 verbose: false); 1638 verbose: false);
1639 }); 1639 });
1640 }); 1640 });
1641 } 1641 }
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