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

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

Issue 10887023: Use new try-catch syntax in runtime/, tools/, and utils/. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « utils/tests/peg/peg_test.dart ('k') | utils/tests/string_encoding/dunit.dart » ('j') | 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 _schedule((_) { 95 _schedule((_) {
96 return _closeServer().transform((_) { 96 return _closeServer().transform((_) {
97 _server = new HttpServer(); 97 _server = new HttpServer();
98 _server.defaultRequestHandler = (request, response) { 98 _server.defaultRequestHandler = (request, response) {
99 var path = request.uri.replaceFirst("/", "").split("/"); 99 var path = request.uri.replaceFirst("/", "").split("/");
100 response.persistentConnection = false; 100 response.persistentConnection = false;
101 var stream; 101 var stream;
102 try { 102 try {
103 stream = baseDir.load(path); 103 stream = baseDir.load(path);
104 } catch (var e) { 104 } catch (e) {
105 response.statusCode = 404; 105 response.statusCode = 404;
106 response.contentLength = 0; 106 response.contentLength = 0;
107 response.outputStream.close(); 107 response.outputStream.close();
108 return; 108 return;
109 } 109 }
110 110
111 var future = consumeInputStream(stream); 111 var future = consumeInputStream(stream);
112 future.then((data) { 112 future.then((data) {
113 response.statusCode = 200; 113 response.statusCode = 200;
114 response.contentLength = data.length; 114 response.contentLength = data.length;
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1091 }
1092 1092
1093 /** 1093 /**
1094 * Schedules a callback to be called after Pub is run with [runPub], even if it 1094 * Schedules a callback to be called after Pub is run with [runPub], even if it
1095 * fails. 1095 * fails.
1096 */ 1096 */
1097 void _scheduleCleanup(_ScheduledEvent event) { 1097 void _scheduleCleanup(_ScheduledEvent event) {
1098 if (_scheduledCleanup == null) _scheduledCleanup = []; 1098 if (_scheduledCleanup == null) _scheduledCleanup = [];
1099 _scheduledCleanup.add(event); 1099 _scheduledCleanup.add(event);
1100 } 1100 }
OLDNEW
« no previous file with comments | « utils/tests/peg/peg_test.dart ('k') | utils/tests/string_encoding/dunit.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698