OLD | NEW |
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 /// 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 ]); | 334 ]); |
335 } | 335 } |
336 | 336 |
337 /// Describes the file in the system cache that contains the client's OAuth2 | 337 /// Describes the file in the system cache that contains the client's OAuth2 |
338 /// credentials. The URL "/token" on [server] will be used as the token | 338 /// credentials. The URL "/token" on [server] will be used as the token |
339 /// endpoint for refreshing the access token. | 339 /// endpoint for refreshing the access token. |
340 Descriptor credentialsFile( | 340 Descriptor credentialsFile( |
341 ScheduledServer server, | 341 ScheduledServer server, |
342 String accessToken, | 342 String accessToken, |
343 {String refreshToken, | 343 {String refreshToken, |
344 Date expiration}) { | 344 DateTime expiration}) { |
345 return async(server.url.then((url) { | 345 return async(server.url.then((url) { |
346 return dir(cachePath, [ | 346 return dir(cachePath, [ |
347 file('credentials.json', new oauth2.Credentials( | 347 file('credentials.json', new oauth2.Credentials( |
348 accessToken, | 348 accessToken, |
349 refreshToken, | 349 refreshToken, |
350 url.resolve('/token'), | 350 url.resolve('/token'), |
351 ['https://www.googleapis.com/auth/userinfo.email'], | 351 ['https://www.googleapis.com/auth/userinfo.email'], |
352 expiration).toJson()) | 352 expiration).toJson()) |
353 ]); | 353 ]); |
354 })); | 354 })); |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 /// calling [completion] is unnecessary. | 1551 /// calling [completion] is unnecessary. |
1552 void expectLater(Future actual, matcher, {String reason, | 1552 void expectLater(Future actual, matcher, {String reason, |
1553 FailureHandler failureHandler, bool verbose: false}) { | 1553 FailureHandler failureHandler, bool verbose: false}) { |
1554 _schedule((_) { | 1554 _schedule((_) { |
1555 return actual.then((value) { | 1555 return actual.then((value) { |
1556 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1556 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
1557 verbose: false); | 1557 verbose: false); |
1558 }); | 1558 }); |
1559 }); | 1559 }); |
1560 } | 1560 } |
OLD | NEW |