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

Side by Side Diff: tools/testing/dart/status_file_parser.dart

Issue 9432023: Add both sync and async methods for getting streams for a File (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
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 #library("status_file_parser"); 5 #library("status_file_parser");
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("status_expression.dart"); 8 #import("status_expression.dart");
9 9
10 // Possible outcomes of running a test. 10 // Possible outcomes of running a test.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 ReadConfigurationInto(statusFilePath, sections, sectionsRead); 54 ReadConfigurationInto(statusFilePath, sections, sectionsRead);
55 } 55 }
56 56
57 void ReadConfigurationInto(path, sections, onDone) { 57 void ReadConfigurationInto(path, sections, onDone) {
58 File file = new File(path); 58 File file = new File(path);
59 if (!file.existsSync()) { 59 if (!file.existsSync()) {
60 throw new Exception('Cannot find test status file $path'); 60 throw new Exception('Cannot find test status file $path');
61 } 61 }
62 InputStream file_stream = file.openInputStream(); 62 // TODO(XXX): When the checked in binary is updated to include the
Mads Ager (google) 2012/02/22 13:20:20 Will you do this as part of committing this?
Søren Gjesse 2012/02/22 14:03:18 No, I would rather postpone until after finishing
63 // openInputStreamSync API remove this try/catch.
64 InputStream file_stream;
65 try {
66 file_stream = file.openInputStreamSync();
67 } catch (NoSuchMethodException e) {
68 file_stream = file.openInputStream();
69 }
63 StringInputStream lines = new StringInputStream(file_stream); 70 StringInputStream lines = new StringInputStream(file_stream);
64 71
65 Section current = new Section.always(); 72 Section current = new Section.always();
66 sections.add(current); 73 sections.add(current);
67 String prefix = ""; 74 String prefix = "";
68 75
69 lines.lineHandler = () { 76 lines.lineHandler = () {
70 String line; 77 String line;
71 while ((line = lines.readLine()) != null) { 78 while ((line = lines.readLine()) != null) {
72 Match match = StripComment.firstMatch(line); 79 Match match = StripComment.firstMatch(line);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 212 }
206 regExps[i] = regExp; 213 regExps[i] = regExp;
207 } 214 }
208 _keyToRegExps[key] = regExps; 215 _keyToRegExps[key] = regExps;
209 }); 216 });
210 217
211 _regExpCache = null; 218 _regExpCache = null;
212 _preprocessed = true; 219 _preprocessed = true;
213 } 220 }
214 } 221 }
OLDNEW
« tests/standalone/src/FileOutputStreamTest.dart ('K') | « tests/standalone/src/StreamPipeTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698