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

Side by Side Diff: test/get/hosted/does_no_network_requests_when_possible_test.dart

Issue 1664563002: Refactor test servers to make them less global. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 10 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
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 import 'package:scheduled_test/scheduled_test.dart'; 5 import 'package:scheduled_test/scheduled_test.dart';
6 6
7 import '../../descriptor.dart' as d; 7 import '../../descriptor.dart' as d;
8 import '../../test_pub.dart'; 8 import '../../test_pub.dart';
9 9
10 main() { 10 main() {
11 integration('does not request versions if the lockfile is up to date', () { 11 integration('does not request versions if the lockfile is up to date', () {
12 servePackages((builder) { 12 servePackages((builder) {
13 builder.serve("foo", "1.0.0"); 13 builder.serve("foo", "1.0.0");
14 builder.serve("foo", "1.1.0"); 14 builder.serve("foo", "1.1.0");
15 builder.serve("foo", "1.2.0"); 15 builder.serve("foo", "1.2.0");
16 }); 16 });
17 17
18 d.appDir({ 18 d.appDir({
19 "foo": "any" 19 "foo": "any"
20 }).create(); 20 }).create();
21 21
22 // Get once so it gets cached. 22 // Get once so it gets cached.
23 pubGet(); 23 pubGet();
24 24
25 // Clear the cache. We don't care about anything that was served during 25 // Clear the cache. We don't care about anything that was served during
26 // the initial get. 26 // the initial get.
27 getRequestedPaths(); 27 globalServer.clearRequestedPaths();
28 28
29 // Run the solver again now that it's cached. 29 // Run the solver again now that it's cached.
30 pubGet(); 30 pubGet();
31 31
32 d.cacheDir({"foo": "1.2.0"}).validate(); 32 d.cacheDir({"foo": "1.2.0"}).validate();
33 d.packagesDir({"foo": "1.2.0"}).validate(); 33 d.packagesDir({"foo": "1.2.0"}).validate();
34 34
35 // The get should not have done any network requests since the lock file is 35 // The get should not have done any network requests since the lock file is
36 // up to date. 36 // up to date.
37 getRequestedPaths().then((paths) { 37 globalServer.requestedPaths.then((paths) {
38 expect(paths, isEmpty); 38 expect(paths, isEmpty);
39 }); 39 });
40 }); 40 });
41 } 41 }
OLDNEW
« no previous file with comments | « test/get/hosted/cached_pubspec_test.dart ('k') | test/get/hosted/stay_locked_if_compatible_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698