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

Unified Diff: utils/tests/pub/test_pub.dart

Issue 11635060: Add a validator for dependency version constraints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/version.dart ('k') | utils/tests/pub/validator_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/test_pub.dart
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
index 78d198ae0da8e43644995f3f9511f2cfe4bf23e2..a1bef634b7a7422487c48630d2954956e4213a38 100644
--- a/utils/tests/pub/test_pub.dart
+++ b/utils/tests/pub/test_pub.dart
@@ -19,10 +19,12 @@ import 'dart:uri';
import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2;
import '../../../pkg/path/lib/path.dart' as path;
import '../../../pkg/unittest/lib/unittest.dart';
+import '../../../pkg/http/lib/testing.dart';
import '../../lib/file_system.dart' as fs;
import '../../pub/entrypoint.dart';
import '../../pub/git_source.dart';
import '../../pub/hosted_source.dart';
+import '../../pub/http.dart';
import '../../pub/io.dart';
import '../../pub/sdk_source.dart';
import '../../pub/system_cache.dart';
@@ -708,6 +710,18 @@ void ensureGit() {
});
}
+/// Use [client] as the mock HTTP client for this test.
+///
+/// Note that this will only affect HTTP requests made via http.dart in the
+/// parent process.
+void useMockClient(MockClient client) {
+ var oldInnerClient = httpClient.inner;
+ httpClient.inner = client;
+ _scheduleCleanup((_) {
+ httpClient.inner = oldInnerClient;
+ });
+}
+
Future<Directory> _setUpSandbox() => createTempDir();
Future _runScheduled(Directory parentDir, List<_ScheduledEvent> scheduled) {
« no previous file with comments | « utils/pub/version.dart ('k') | utils/tests/pub/validator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698