| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(nweiz): Remove this tag when we can get [packageDir] working without it | 5 // TODO(nweiz): Remove this tag when we can get [packageDir] working without it |
| 6 // (dart-lang/sdk#24022). | 6 // (dart-lang/sdk#24022). |
| 7 library test.test.io; | 7 library test.test.io; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 /// The platform-specific message emitted when a nonexistent file is loaded. | 27 /// The platform-specific message emitted when a nonexistent file is loaded. |
| 28 final String noSuchFileMessage = Platform.isWindows | 28 final String noSuchFileMessage = Platform.isWindows |
| 29 ? "The system cannot find the file specified." | 29 ? "The system cannot find the file specified." |
| 30 : "No such file or directory"; | 30 : "No such file or directory"; |
| 31 | 31 |
| 32 /// A regular expression that matches the output of "pub serve". | 32 /// A regular expression that matches the output of "pub serve". |
| 33 final _servingRegExp = | 33 final _servingRegExp = |
| 34 new RegExp(r'^Serving myapp [a-z]+ on http://localhost:(\d+)$'); | 34 new RegExp(r'^Serving myapp [a-z]+ on http://localhost:(\d+)$'); |
| 35 | 35 |
| 36 /// An operating system name that's different than the current operating system. |
| 37 final otherOS = Platform.isWindows ? "mac-os" : "windows"; |
| 38 |
| 36 /// A future that will return the port of a pub serve instance run via | 39 /// A future that will return the port of a pub serve instance run via |
| 37 /// [runPubServe]. | 40 /// [runPubServe]. |
| 38 /// | 41 /// |
| 39 /// This should only be called after [runPubServe]. | 42 /// This should only be called after [runPubServe]. |
| 40 Future<int> get pubServePort => _pubServePortCompleter.future; | 43 Future<int> get pubServePort => _pubServePortCompleter.future; |
| 41 Completer<int> _pubServePortCompleter; | 44 Completer<int> _pubServePortCompleter; |
| 42 | 45 |
| 43 /// The path to the sandbox directory. | 46 /// The path to the sandbox directory. |
| 44 /// | 47 /// |
| 45 /// This is only set in tests for which [useSandbox] is active. | 48 /// This is only set in tests for which [useSandbox] is active. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 var match; | 175 var match; |
| 173 while (match == null) { | 176 while (match == null) { |
| 174 var line = await pub.stdout.next(); | 177 var line = await pub.stdout.next(); |
| 175 match = _servingRegExp.firstMatch(line); | 178 match = _servingRegExp.firstMatch(line); |
| 176 } | 179 } |
| 177 _pubServePortCompleter.complete(int.parse(match[1])); | 180 _pubServePortCompleter.complete(int.parse(match[1])); |
| 178 }, "waiting for pub serve to emit its port number"); | 181 }, "waiting for pub serve to emit its port number"); |
| 179 | 182 |
| 180 return pub; | 183 return pub; |
| 181 } | 184 } |
| OLD | NEW |