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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/hosted/version_negotiation_test.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library pub_tests; 1 library pub_tests;
6
7 import 'package:scheduled_test/scheduled_server.dart'; 2 import 'package:scheduled_test/scheduled_server.dart';
8 import 'package:scheduled_test/scheduled_test.dart'; 3 import 'package:scheduled_test/scheduled_test.dart';
9 import 'package:shelf/shelf.dart' as shelf; 4 import 'package:shelf/shelf.dart' as shelf;
10
11 import '../descriptor.dart' as d; 5 import '../descriptor.dart' as d;
12 import '../test_pub.dart'; 6 import '../test_pub.dart';
13
14 main() { 7 main() {
15 initConfig(); 8 initConfig();
16
17 forBothPubGetAndUpgrade((command) { 9 forBothPubGetAndUpgrade((command) {
18 integration('sends the correct Accept header', () { 10 integration('sends the correct Accept header', () {
19 var server = new ScheduledServer(); 11 var server = new ScheduledServer();
20
21 d.appDir({ 12 d.appDir({
22 "foo": { 13 "foo": {
23 "hosted": { 14 "hosted": {
24 "name": "foo", 15 "name": "foo",
25 "url": server.url.then((url) => url.toString()) 16 "url": server.url.then((url) => url.toString())
26 } 17 }
27 } 18 }
28 }).create(); 19 }).create();
29
30 var pub = startPub(args: [command.name]); 20 var pub = startPub(args: [command.name]);
31
32 server.handle('GET', '/api/packages/foo', (request) { 21 server.handle('GET', '/api/packages/foo', (request) {
33 expect(request.headers['accept'], 22 expect(
23 request.headers['accept'],
34 equals('application/vnd.pub.v2+json')); 24 equals('application/vnd.pub.v2+json'));
35 return new shelf.Response(200); 25 return new shelf.Response(200);
36 }); 26 });
37
38 pub.kill(); 27 pub.kill();
39 }); 28 });
40
41 integration('prints a friendly error if the version is out-of-date', () { 29 integration('prints a friendly error if the version is out-of-date', () {
42 var server = new ScheduledServer(); 30 var server = new ScheduledServer();
43
44 d.appDir({ 31 d.appDir({
45 "foo": { 32 "foo": {
46 "hosted": { 33 "hosted": {
47 "name": "foo", 34 "name": "foo",
48 "url": server.url.then((url) => url.toString()) 35 "url": server.url.then((url) => url.toString())
49 } 36 }
50 } 37 }
51 }).create(); 38 }).create();
52
53 var pub = startPub(args: [command.name]); 39 var pub = startPub(args: [command.name]);
54 40 server.handle(
55 server.handle('GET', '/api/packages/foo', 41 'GET',
42 '/api/packages/foo',
56 (request) => new shelf.Response(406)); 43 (request) => new shelf.Response(406));
57
58 pub.shouldExit(1); 44 pub.shouldExit(1);
59 45 pub.stderr.expect(
60 pub.stderr.expect(emitsLines( 46 emitsLines(
61 "Pub 0.1.2+3 is incompatible with the current version of localhost.\n" 47 "Pub 0.1.2+3 is incompatible with the current version of localhost .\n"
62 "Upgrade pub to the latest version and try again.")); 48 "Upgrade pub to the latest version and try again."));
63 }); 49 });
64 }); 50 });
65 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698