| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 schedule(() { | 98 schedule(() { |
| 99 return _closeServer().then((_) { | 99 return _closeServer().then((_) { |
| 100 return SafeHttpServer.bind("localhost", 0).then((server) { | 100 return SafeHttpServer.bind("localhost", 0).then((server) { |
| 101 _server = server; | 101 _server = server; |
| 102 server.listen((request) { | 102 server.listen((request) { |
| 103 currentSchedule.heartbeat(); | 103 currentSchedule.heartbeat(); |
| 104 var response = request.response; | 104 var response = request.response; |
| 105 try { | 105 try { |
| 106 var path = request.uri.path.replaceFirst("/", ""); | 106 var path = request.uri.path.replaceFirst("/", ""); |
| 107 | |
| 108 if (_requestedPaths == null) _requestedPaths = <String>[]; | |
| 109 _requestedPaths.add(path); | 107 _requestedPaths.add(path); |
| 110 | 108 |
| 111 response.persistentConnection = false; | 109 response.persistentConnection = false; |
| 112 var stream = baseDir.load(path); | 110 var stream = baseDir.load(path); |
| 113 | 111 |
| 114 new ByteStream(stream).toBytes().then((data) { | 112 new ByteStream(stream).toBytes().then((data) { |
| 115 currentSchedule.heartbeat(); | 113 currentSchedule.heartbeat(); |
| 116 response.statusCode = 200; | 114 response.statusCode = 200; |
| 117 response.contentLength = data.length; | 115 response.contentLength = data.length; |
| 118 response.add(data); | 116 response.add(data); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 bool matches(item, MatchState matchState) { | 680 bool matches(item, MatchState matchState) { |
| 683 if (item is! Pair) return false; | 681 if (item is! Pair) return false; |
| 684 return _firstMatcher.matches(item.first, matchState) && | 682 return _firstMatcher.matches(item.first, matchState) && |
| 685 _lastMatcher.matches(item.last, matchState); | 683 _lastMatcher.matches(item.last, matchState); |
| 686 } | 684 } |
| 687 | 685 |
| 688 Description describe(Description description) { | 686 Description describe(Description description) { |
| 689 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 687 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
| 690 } | 688 } |
| 691 } | 689 } |
| OLD | NEW |