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

Side by Side Diff: utils/testrunner/layout_test_controller.dart

Issue 11343009: Get rid of 'close' on process. It is very easy to use incorrectly and cut off data from your stream… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 years, 1 month 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 | « tools/testing/dart/test_suite.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 // The following set of variables should be set by the caller that 5 // The following set of variables should be set by the caller that
6 // #sources this file. 6 // #sources this file.
7 /** Whether to include elapsed time. */ 7 /** Whether to include elapsed time. */
8 8
9 part of test_controller; 9 part of test_controller;
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 printSummary(testfile, passCount, failCount, errorCount); 122 printSummary(testfile, passCount, failCount, errorCount);
123 } 123 }
124 notifyDone(failCount > 0 ? -1 : 0); 124 notifyDone(failCount > 0 ? -1 : 0);
125 } 125 }
126 126
127 runTextLayoutTest(testNum) { 127 runTextLayoutTest(testNum) {
128 var url = '$baseUrl?test=$testNum'; 128 var url = '$baseUrl?test=$testNum';
129 var stdout = new List(); 129 var stdout = new List();
130 start = new Date.now(); 130 start = new Date.now();
131 Process.start(drt, [url]).then((process) { 131 Process.start(drt, [url]).then((process) {
132 // Drain stderr to not leak resources.
133 process.stderr.onData = process.stderr.read;
132 StringInputStream stdoutStringStream = 134 StringInputStream stdoutStringStream =
133 new StringInputStream(process.stdout); 135 new StringInputStream(process.stdout);
134 stdoutStringStream.onLine = () { 136 stdoutStringStream.onLine = () {
135 if (stdoutStringStream.closed) return; 137 if (stdoutStringStream.closed) return;
136 var line = stdoutStringStream.readLine(); 138 var line = stdoutStringStream.readLine();
137 while (null != line) { 139 while (null != line) {
138 stdout.add(line); 140 stdout.add(line);
139 line = stdoutStringStream.readLine(); 141 line = stdoutStringStream.readLine();
140 } 142 }
141 }; 143 };
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 208 }
207 }; 209 };
208 }); 210 });
209 } 211 }
210 212
211 runPixelLayoutTest(int testNum) { 213 runPixelLayoutTest(int testNum) {
212 var url = '$baseUrl?test=$testNum'; 214 var url = '$baseUrl?test=$testNum';
213 var stdout = new List(); 215 var stdout = new List();
214 start = new Date.now(); 216 start = new Date.now();
215 Process.start(drt, ["$url'-p"]).then((process) { 217 Process.start(drt, ["$url'-p"]).then((process) {
218 // Drain stderr to not leak resources.
219 process.stderr.onData = process.stderr.read;
216 ListInputStream stdoutStream = process.stdout; 220 ListInputStream stdoutStream = process.stdout;
217 stdoutStream.onData = () { 221 stdoutStream.onData = () {
218 if (!stdoutStream.closed) { 222 if (!stdoutStream.closed) {
219 var data = stdoutStream.read(); 223 var data = stdoutStream.read();
220 stdout.addAll(data); 224 stdout.addAll(data);
221 } 225 }
222 }; 226 };
223 stdoutStream.onError = (e) { 227 stdoutStream.onError = (e) {
224 print(e); 228 print(e);
225 }; 229 };
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 313
310 void runPixelLayoutTests() { 314 void runPixelLayoutTests() {
311 init(); 315 init();
312 runPixelLayoutTest(0); 316 runPixelLayoutTest(0);
313 } 317 }
314 318
315 void runTextLayoutTests() { 319 void runTextLayoutTests() {
316 init(); 320 init();
317 runTextLayoutTest(0); 321 runTextLayoutTest(0);
318 } 322 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698