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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 ]); | 345 ]); |
346 } | 346 } |
347 | 347 |
348 /// Describes the file in the system cache that contains the client's OAuth2 | 348 /// Describes the file in the system cache that contains the client's OAuth2 |
349 /// credentials. The URL "/token" on [server] will be used as the token | 349 /// credentials. The URL "/token" on [server] will be used as the token |
350 /// endpoint for refreshing the access token. | 350 /// endpoint for refreshing the access token. |
351 Descriptor credentialsFile( | 351 Descriptor credentialsFile( |
352 ScheduledServer server, | 352 ScheduledServer server, |
353 String accessToken, | 353 String accessToken, |
354 {String refreshToken, | 354 {String refreshToken, |
355 Date expiration}) { | 355 DateTime expiration}) { |
356 return async(server.url.then((url) { | 356 return async(server.url.then((url) { |
357 return dir(cachePath, [ | 357 return dir(cachePath, [ |
358 file('credentials.json', new oauth2.Credentials( | 358 file('credentials.json', new oauth2.Credentials( |
359 accessToken, | 359 accessToken, |
360 refreshToken, | 360 refreshToken, |
361 url.resolve('/token'), | 361 url.resolve('/token'), |
362 ['https://www.googleapis.com/auth/userinfo.email'], | 362 ['https://www.googleapis.com/auth/userinfo.email'], |
363 expiration).toJson()) | 363 expiration).toJson()) |
364 ]); | 364 ]); |
365 })); | 365 })); |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 /// calling [completion] is unnecessary. | 1558 /// calling [completion] is unnecessary. |
1559 void expectLater(Future actual, matcher, {String reason, | 1559 void expectLater(Future actual, matcher, {String reason, |
1560 FailureHandler failureHandler, bool verbose: false}) { | 1560 FailureHandler failureHandler, bool verbose: false}) { |
1561 _schedule((_) { | 1561 _schedule((_) { |
1562 return actual.then((value) { | 1562 return actual.then((value) { |
1563 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1563 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
1564 verbose: false); | 1564 verbose: false); |
1565 }); | 1565 }); |
1566 }); | 1566 }); |
1567 } | 1567 } |
OLD | NEW |