| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub | 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub |
| 6 /// tests are integration tests that stage some stuff on the file system, run | 6 /// tests are integration tests that stage some stuff on the file system, run |
| 7 /// pub, and then validate the results. This library provides an API to build | 7 /// pub, and then validate the results. This library provides an API to build |
| 8 /// tests like that. | 8 /// tests like that. |
| 9 library test_pub; | 9 library test_pub; |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 /// A future that will complete to the port used for the current server. | 81 /// A future that will complete to the port used for the current server. |
| 82 Future<int> get port => _portCompleter.future; | 82 Future<int> get port => _portCompleter.future; |
| 83 | 83 |
| 84 /// Gets the list of paths that have been requested from the server since the | 84 /// Gets the list of paths that have been requested from the server since the |
| 85 /// last time this was called (or since the server was first spun up). | 85 /// last time this was called (or since the server was first spun up). |
| 86 Future<List<String>> getRequestedPaths() { | 86 Future<List<String>> getRequestedPaths() { |
| 87 return schedule(() { | 87 return schedule(() { |
| 88 var paths = _requestedPaths.toList(); | 88 var paths = _requestedPaths.toList(); |
| 89 _requestedPaths.clear(); | 89 _requestedPaths.clear(); |
| 90 return paths; | 90 return paths; |
| 91 }); | 91 }, "get previous network requests"); |
| 92 } | 92 } |
| 93 | 93 |
| 94 /// Creates an HTTP server to serve [contents] as static files. This server will | 94 /// Creates an HTTP server to serve [contents] as static files. This server will |
| 95 /// exist only for the duration of the pub run. | 95 /// exist only for the duration of the pub run. |
| 96 /// | 96 /// |
| 97 /// Subsequent calls to [serve] will replace the previous server. | 97 /// Subsequent calls to [serve] will replace the previous server. |
| 98 void serve([List<d.Descriptor> contents]) { | 98 void serve([List<d.Descriptor> contents]) { |
| 99 var baseDir = d.dir("serve-dir", contents); | 99 var baseDir = d.dir("serve-dir", contents); |
| 100 | 100 |
| 101 _hasServer = true; | 101 _hasServer = true; |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 bool matches(item, Map matchState) { | 842 bool matches(item, Map matchState) { |
| 843 if (item is! Pair) return false; | 843 if (item is! Pair) return false; |
| 844 return _firstMatcher.matches(item.first, matchState) && | 844 return _firstMatcher.matches(item.first, matchState) && |
| 845 _lastMatcher.matches(item.last, matchState); | 845 _lastMatcher.matches(item.last, matchState); |
| 846 } | 846 } |
| 847 | 847 |
| 848 Description describe(Description description) { | 848 Description describe(Description description) { |
| 849 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 849 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
| 850 } | 850 } |
| 851 } | 851 } |
| OLD | NEW |