Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: utils/tests/pub/oauth2_test.dart

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/testrunner/utils.dart ('k') | utils/tests/pub/pub_lish_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/oauth2_test.dart
diff --git a/utils/tests/pub/oauth2_test.dart b/utils/tests/pub/oauth2_test.dart
index 62d4f9135e75ce28949b54028295f6b471fe4d76..c4d087312bc09d96574a88bab919bb56af59e527 100644
--- a/utils/tests/pub/oauth2_test.dart
+++ b/utils/tests/pub/oauth2_test.dart
@@ -28,7 +28,7 @@ main() {
expect(request.headers.value('authorization'),
equals('Bearer access token'));
- response.outputStream.close();
+ response.close();
});
// After we give pub an invalid response, it should crash. We wait for it to
@@ -48,7 +48,7 @@ main() {
expect(request.headers.value('authorization'),
equals('Bearer access token'));
- response.outputStream.close();
+ response.close();
});
pub.kill();
@@ -66,17 +66,17 @@ main() {
confirmPublish(pub);
server.handle('POST', '/token', (request, response) {
- return wrapInputStream(request.inputStream).toBytes().then((bytes) {
+ return new ByteStream(request).toBytes().then((bytes) {
var body = new String.fromCharCodes(bytes);
expect(body, matches(
new RegExp(r'(^|&)refresh_token=refresh\+token(&|$)')));
response.headers.contentType = new ContentType("application", "json");
- response.outputStream.writeString(json.stringify({
+ response.addString(json.stringify({
"access_token": "new access token",
"token_type": "bearer"
}));
- response.outputStream.close();
+ response.close();
});
});
@@ -84,7 +84,7 @@ main() {
expect(request.headers.value('authorization'),
equals('Bearer new access token'));
- response.outputStream.close();
+ response.close();
});
pub.shouldExit();
@@ -111,7 +111,7 @@ main() {
expect(request.headers.value('authorization'),
equals('Bearer new access token'));
- response.outputStream.close();
+ response.close();
});
// After we give pub an invalid response, it should crash. We wait for it to
@@ -136,7 +136,7 @@ main() {
expect(request.headers.value('authorization'),
equals('Bearer new access token'));
- response.outputStream.close();
+ response.close();
});
@@ -159,10 +159,10 @@ main() {
response.statusCode = 401;
response.headers.set('www-authenticate', 'Bearer error="invalid_token",'
' error_description="your token sucks"');
- response.outputStream.writeString(json.stringify({
+ response.addString(json.stringify({
'error': {'message': 'your token sucks'}
}));
- response.outputStream.close();
+ response.close();
});
expectLater(pub.nextErrLine(), equals('OAuth2 authorization failed (your '
@@ -205,16 +205,16 @@ void authorizePub(ScheduledProcess pub, ScheduledServer server,
void handleAccessTokenRequest(ScheduledServer server, String accessToken) {
server.handle('POST', '/token', (request, response) {
- return wrapInputStream(request.inputStream).toBytes().then((bytes) {
+ return new ByteStream(request).toBytes().then((bytes) {
var body = new String.fromCharCodes(bytes);
expect(body, matches(new RegExp(r'(^|&)code=access\+code(&|$)')));
response.headers.contentType = new ContentType("application", "json");
- response.outputStream.writeString(json.stringify({
+ response.addString(json.stringify({
"access_token": accessToken,
"token_type": "bearer"
}));
- response.outputStream.close();
+ response.close();
});
});
}
« no previous file with comments | « utils/testrunner/utils.dart ('k') | utils/tests/pub/pub_lish_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698