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

Unified Diff: dart/tests/try/web/web_compiler_test_case.dart

Issue 752673002: Cache HttpRequest in test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r41951. Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/try/web/web_compiler_test_case.dart
diff --git a/dart/tests/try/web/web_compiler_test_case.dart b/dart/tests/try/web/web_compiler_test_case.dart
index 60dd8b9889f76e4930e3504b1541118f8887f9b1..baaff003cccac6defd348bd0242444b96cc5173d 100644
--- a/dart/tests/try/web/web_compiler_test_case.dart
+++ b/dart/tests/try/web/web_compiler_test_case.dart
@@ -81,6 +81,8 @@ class WebInputProvider {
final Map<Uri, Future> cachedSources = new Map<Uri, Future>();
+ static final Map<String, Future> cachedRequests = new Map<String, Future>();
+
WebInputProvider(
this.source, this.mainUri, this.libraryRoot, this.packageRoot);
@@ -88,12 +90,16 @@ class WebInputProvider {
return cachedSources.putIfAbsent(uri, () {
if (uri == mainUri) return new Future.value(source);
if (uri.scheme == WEB_SCHEME) {
- return HttpRequest.getString('/root_dart${uri.path}');
+ return cachedHttpRequest('/root_dart${uri.path}');
} else {
- return HttpRequest.getString('$uri');
+ return cachedHttpRequest('$uri');
}
});
}
+
+ static Future cachedHttpRequest(String uri) {
+ return cachedRequests.putIfAbsent(uri, () => HttpRequest.getString(uri));
+ }
}
/// Output provider which collect output in [output].
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698