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

Unified Diff: sdk/lib/_internal/pub_generated/test/oauth2/utils.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
Index: sdk/lib/_internal/pub_generated/test/oauth2/utils.dart
diff --git a/sdk/lib/_internal/pub/test/oauth2/utils.dart b/sdk/lib/_internal/pub_generated/test/oauth2/utils.dart
similarity index 62%
copy from sdk/lib/_internal/pub/test/oauth2/utils.dart
copy to sdk/lib/_internal/pub_generated/test/oauth2/utils.dart
index d69941b39b81b187f908068116b073c59a4ed8a8..083754867663352aff5a488157c7da35b3796cfa 100644
--- a/sdk/lib/_internal/pub/test/oauth2/utils.dart
+++ b/sdk/lib/_internal/pub_generated/test/oauth2/utils.dart
@@ -1,53 +1,44 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
library oauth2.utils;
-
import 'dart:convert';
-
import 'package:http/http.dart' as http;
import 'package:scheduled_test/scheduled_process.dart';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
import 'package:shelf/shelf.dart' as shelf;
-
import '../../lib/src/utils.dart';
-
void authorizePub(ScheduledProcess pub, ScheduledServer server,
- [String accessToken="access token"]) {
- pub.stdout.expect('Pub needs your authorization to upload packages on your '
- 'behalf.');
-
+ [String accessToken = "access token"]) {
+ pub.stdout.expect(
+ 'Pub needs your authorization to upload packages on your ' 'behalf.');
schedule(() {
return pub.stdout.next().then((line) {
- var match = new RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]')
- .firstMatch(line);
+ var match =
+ new RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]').firstMatch(line);
expect(match, isNotNull);
-
var redirectUrl = Uri.parse(Uri.decodeComponent(match.group(1)));
- redirectUrl = addQueryParameters(redirectUrl, {'code': 'access code'});
- return (new http.Request('GET', redirectUrl)..followRedirects = false)
- .send();
+ redirectUrl = addQueryParameters(redirectUrl, {
+ 'code': 'access code'
+ });
+ return (new http.Request('GET', redirectUrl)..followRedirects =
+ false).send();
}).then((response) {
- expect(response.headers['location'],
+ expect(
+ response.headers['location'],
equals('http://pub.dartlang.org/authorized'));
});
});
-
handleAccessTokenRequest(server, accessToken);
}
-
void handleAccessTokenRequest(ScheduledServer server, String accessToken) {
server.handle('POST', '/token', (request) {
return request.readAsString().then((body) {
expect(body, matches(new RegExp(r'(^|&)code=access\+code(&|$)')));
-
return new shelf.Response.ok(JSON.encode({
"access_token": accessToken,
"token_type": "bearer"
- }), headers: {'content-type': 'application/json'});
+ }), headers: {
+ 'content-type': 'application/json'
+ });
});
});
}
-

Powered by Google App Engine
This is Rietveld 408576698