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

Side by Side Diff: utils/tests/pub/validator/dependency_test.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 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/tests/pub/test_pub.dart ('k') | utils/tests/pub/validator/size_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:json' as json; 6 import 'dart:json' as json;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart'; 9 import 'package:http/testing.dart';
10 import 'package:pathos/path.dart' as path; 10 import 'package:pathos/path.dart' as path;
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 /// Sets up a test package with dependency [dep] and mocks a server with 33 /// Sets up a test package with dependency [dep] and mocks a server with
34 /// [hostedVersions] of the package available. 34 /// [hostedVersions] of the package available.
35 setUpDependency(Map dep, {List<String> hostedVersions}) { 35 setUpDependency(Map dep, {List<String> hostedVersions}) {
36 useMockClient(new MockClient((request) { 36 useMockClient(new MockClient((request) {
37 expect(request.method, equals("GET")); 37 expect(request.method, equals("GET"));
38 expect(request.url.path, equals("/packages/foo.json")); 38 expect(request.url.path, equals("/packages/foo.json"));
39 39
40 if (hostedVersions == null) { 40 if (hostedVersions == null) {
41 return new Future.immediate(new http.Response("not found", 404)); 41 return new Future.value(new http.Response("not found", 404));
42 } else { 42 } else {
43 return new Future.immediate(new http.Response(json.stringify({ 43 return new Future.value(new http.Response(json.stringify({
44 "name": "foo", 44 "name": "foo",
45 "uploaders": ["nweiz@google.com"], 45 "uploaders": ["nweiz@google.com"],
46 "versions": hostedVersions 46 "versions": hostedVersions
47 }), 200)); 47 }), 200));
48 } 48 }
49 })); 49 }));
50 50
51 d.dir(appPath, [ 51 d.dir(appPath, [
52 d.libPubspec("test_pkg", "1.0.0", deps: [dep]) 52 d.libPubspec("test_pkg", "1.0.0", deps: [dep])
53 ]).create(); 53 ]).create();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 d.dir(appPath, [ 241 d.dir(appPath, [
242 d.libPubspec("test_pkg", "1.0.0", deps: [ 242 d.libPubspec("test_pkg", "1.0.0", deps: [
243 {'hosted': {'name': 'test_pkg', 'version': '>=1.0.0'}} 243 {'hosted': {'name': 'test_pkg', 'version': '>=1.0.0'}}
244 ]) 244 ])
245 ]).create(); 245 ]).create();
246 246
247 expectValidationWarning(dependency); 247 expectValidationWarning(dependency);
248 }); 248 });
249 }); 249 });
250 } 250 }
OLDNEW
« no previous file with comments | « utils/tests/pub/test_pub.dart ('k') | utils/tests/pub/validator/size_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698