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

Unified Diff: runtime/vm/unit_test.cc

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « runtime/vm/benchmark_test.cc ('k') | sdk/bin/dart2js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unit_test.cc
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 1cb7ccf98f4d9aca476f68ce1e42fdad463d100f..672215112e79654058948352b5e7d3634159fcdb 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -48,6 +48,23 @@ void TestCaseBase::RunAll() {
}
}
+static const char* kPackageScheme = "package:";
+
+static bool IsPackageSchemeURL(const char* url_name) {
+ static const intptr_t kPackageSchemeLen = strlen(kPackageScheme);
+ return (strncmp(url_name, kPackageScheme, kPackageSchemeLen) == 0);
+}
+
+static Dart_Handle ResolvePackageUri(Dart_Handle builtin_lib,
+ const char* uri_chars) {
+ const int kNumArgs = 1;
+ Dart_Handle dart_args[kNumArgs];
+ dart_args[0] = DartUtils::NewString(uri_chars);
+ return Dart_Invoke(builtin_lib,
+ DartUtils::NewString("_filePathFromUri"),
+ kNumArgs,
+ dart_args);
+}
static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
Dart_Handle library,
@@ -108,6 +125,15 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
url_chars),
0, 0);
}
+ if (IsPackageSchemeURL(url_chars)) {
+ Dart_Handle resolved_uri = ResolvePackageUri(builtin_lib, url_chars);
+ DART_CHECK_VALID(resolved_uri);
+ url_chars = NULL;
+ Dart_Handle result = Dart_StringToCString(resolved_uri, &url_chars);
+ if (Dart_IsError(result)) {
+ return Dart_NewApiError("accessing url characters failed");
+ }
+ }
// Do sync loading since unit_test doesn't support async.
Dart_Handle source = DartUtils::ReadStringFromFile(url_chars);
EXPECT_VALID(source);
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | sdk/bin/dart2js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698