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

Side by Side Diff: utils/tests/pub/oauth2_test.dart

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/testrunner/standard_test_runner.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library oauth2_test; 5 library oauth2_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:json' as json; 8 import 'dart:json' as json;
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 }); 50 });
51 51
52 pub.kill(); 52 pub.kill();
53 }); 53 });
54 54
55 integration('with an expired credentials.json, refreshes and saves the ' 55 integration('with an expired credentials.json, refreshes and saves the '
56 'refreshed access token to credentials.json', () { 56 'refreshed access token to credentials.json', () {
57 var server = new ScheduledServer(); 57 var server = new ScheduledServer();
58 credentialsFile(server, 'access token', 58 credentialsFile(server, 'access token',
59 refreshToken: 'refresh token', 59 refreshToken: 'refresh token',
60 expiration: new Date.now().subtract(new Duration(hours: 1))) 60 expiration: new DateTime.now().subtract(new Duration(hours: 1)))
61 .scheduleCreate(); 61 .scheduleCreate();
62 62
63 var pub = startPubLish(server); 63 var pub = startPubLish(server);
64 confirmPublish(pub); 64 confirmPublish(pub);
65 65
66 server.handle('POST', '/token', (request, response) { 66 server.handle('POST', '/token', (request, response) {
67 return consumeInputStream(request.inputStream).then((bytes) { 67 return consumeInputStream(request.inputStream).then((bytes) {
68 var body = new String.fromCharCodes(bytes); 68 var body = new String.fromCharCodes(bytes);
69 expect(body, matches( 69 expect(body, matches(
70 new RegExp(r'(^|&)refresh_token=refresh\+token(&|$)'))); 70 new RegExp(r'(^|&)refresh_token=refresh\+token(&|$)')));
(...skipping 17 matching lines...) Expand all
88 pub.shouldExit(); 88 pub.shouldExit();
89 89
90 credentialsFile(server, 'new access token', refreshToken: 'refresh token') 90 credentialsFile(server, 'new access token', refreshToken: 'refresh token')
91 .scheduleValidate(); 91 .scheduleValidate();
92 }); 92 });
93 93
94 integration('with an expired credentials.json without a refresh token, ' 94 integration('with an expired credentials.json without a refresh token, '
95 'authenticates again and saves credentials.json', () { 95 'authenticates again and saves credentials.json', () {
96 var server = new ScheduledServer(); 96 var server = new ScheduledServer();
97 credentialsFile(server, 'access token', 97 credentialsFile(server, 'access token',
98 expiration: new Date.now().subtract(new Duration(hours: 1))) 98 expiration: new DateTime.now().subtract(new Duration(hours: 1)))
99 .scheduleCreate(); 99 .scheduleCreate();
100 100
101 var pub = startPubLish(server); 101 var pub = startPubLish(server);
102 confirmPublish(pub); 102 confirmPublish(pub);
103 103
104 expectLater(pub.nextErrLine(), equals("Pub's authorization to upload " 104 expectLater(pub.nextErrLine(), equals("Pub's authorization to upload "
105 "packages has expired and can't be automatically refreshed.")); 105 "packages has expired and can't be automatically refreshed."));
106 authorizePub(pub, server, "new access token"); 106 authorizePub(pub, server, "new access token");
107 107
108 server.handle('GET', '/packages/versions/new.json', (request, response) { 108 server.handle('GET', '/packages/versions/new.json', (request, response) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 response.headers.contentType = new ContentType("application", "json"); 205 response.headers.contentType = new ContentType("application", "json");
206 response.outputStream.writeString(json.stringify({ 206 response.outputStream.writeString(json.stringify({
207 "access_token": accessToken, 207 "access_token": accessToken,
208 "token_type": "bearer" 208 "token_type": "bearer"
209 })); 209 }));
210 response.outputStream.close(); 210 response.outputStream.close();
211 }); 211 });
212 }); 212 });
213 } 213 }
OLDNEW
« no previous file with comments | « utils/testrunner/standard_test_runner.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698