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

Side by Side Diff: sdk/lib/_internal/pub/test/oauth2/utils.dart

Issue 298683003: Use shelf in pub's barback and admin servers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 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 | « sdk/lib/_internal/pub/test/lish/utils.dart ('k') | no next file » | 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.utils; 5 library oauth2.utils;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:io';
9 8
10 import 'package:http/http.dart' as http; 9 import 'package:http/http.dart' as http;
11 import 'package:scheduled_test/scheduled_process.dart'; 10 import 'package:scheduled_test/scheduled_process.dart';
12 import 'package:scheduled_test/scheduled_test.dart'; 11 import 'package:scheduled_test/scheduled_test.dart';
13 import 'package:scheduled_test/scheduled_server.dart'; 12 import 'package:scheduled_test/scheduled_server.dart';
14 import 'package:shelf/shelf.dart' as shelf; 13 import 'package:shelf/shelf.dart' as shelf;
15 14
16 import '../../lib/src/io.dart';
17 import '../../lib/src/utils.dart'; 15 import '../../lib/src/utils.dart';
18 16
19 void authorizePub(ScheduledProcess pub, ScheduledServer server, 17 void authorizePub(ScheduledProcess pub, ScheduledServer server,
20 [String accessToken="access token"]) { 18 [String accessToken="access token"]) {
21 pub.stdout.expect('Pub needs your authorization to upload packages on your ' 19 pub.stdout.expect('Pub needs your authorization to upload packages on your '
22 'behalf.'); 20 'behalf.');
23 21
24 schedule(() { 22 schedule(() {
25 return pub.stdout.next().then((line) { 23 return pub.stdout.next().then((line) {
26 var match = new RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]') 24 var match = new RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]')
(...skipping 19 matching lines...) Expand all
46 expect(body, matches(new RegExp(r'(^|&)code=access\+code(&|$)'))); 44 expect(body, matches(new RegExp(r'(^|&)code=access\+code(&|$)')));
47 45
48 return new shelf.Response.ok(JSON.encode({ 46 return new shelf.Response.ok(JSON.encode({
49 "access_token": accessToken, 47 "access_token": accessToken,
50 "token_type": "bearer" 48 "token_type": "bearer"
51 }), headers: {'content-type': 'application/json'}); 49 }), headers: {'content-type': 'application/json'});
52 }); 50 });
53 }); 51 });
54 } 52 }
55 53
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/lish/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698