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

Side by Side Diff: test/get/hosted/cached_pubspec_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 a pubspec for a cached package', () { 11 integration('does not request a pubspec for a cached package', () {
12 servePackages((builder) => builder.serve("foo", "1.2.3")); 12 servePackages((builder) => builder.serve("foo", "1.2.3"));
13 13
14 d.appDir({"foo": "1.2.3"}).create(); 14 d.appDir({"foo": "1.2.3"}).create();
15 15
16 // Get once so it gets cached. 16 // Get once so it gets cached.
17 pubGet(); 17 pubGet();
18 18
19 // Clear the cache. We don't care about anything that was served during 19 // Clear the cache. We don't care about anything that was served during
20 // the initial get. 20 // the initial get.
21 getRequestedPaths(); 21 globalServer.clearRequestedPaths();
22 22
23 d.cacheDir({"foo": "1.2.3"}).validate(); 23 d.cacheDir({"foo": "1.2.3"}).validate();
24 d.packagesDir({"foo": "1.2.3"}).validate(); 24 d.packagesDir({"foo": "1.2.3"}).validate();
25 25
26 // Run the solver again now that it's cached. 26 // Run the solver again now that it's cached.
27 pubGet(); 27 pubGet();
28 28
29 // The get should not have requested the pubspec since it's local already. 29 // The get should not have requested the pubspec since it's local already.
30 getRequestedPaths().then((paths) { 30 globalServer.requestedPaths.then((paths) {
31 expect(paths, isNot(contains("packages/foo/versions/1.2.3.yaml"))); 31 expect(paths, isNot(contains("packages/foo/versions/1.2.3.yaml")));
32 }); 32 });
33 }); 33 });
34 } 34 }
OLDNEW
« no previous file with comments | « test/get/hosted/avoid_network_requests_test.dart ('k') | test/get/hosted/does_no_network_requests_when_possible_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698