| Index: runtime/vm/unit_test.cc
|
| diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
|
| index 05d8d3f6b09a940491cf60362e62a0eff7d3fda7..03eaaa3d9812d9d5effd6c1fa6676c903438c8c1 100644
|
| --- a/runtime/vm/unit_test.cc
|
| +++ b/runtime/vm/unit_test.cc
|
| @@ -8,8 +8,10 @@
|
|
|
| #include "bin/builtin.h"
|
| #include "bin/dartutils.h"
|
| +#include "bin/isolate_data.h"
|
|
|
| #include "platform/globals.h"
|
| +
|
| #include "vm/assembler.h"
|
| #include "vm/ast_printer.h"
|
| #include "vm/compiler.h"
|
| @@ -49,6 +51,21 @@ void TestCaseBase::RunAll() {
|
| }
|
| }
|
|
|
| +
|
| +Dart_Isolate TestCase::CreateIsolate(const uint8_t* buffer, const char* name) {
|
| + bin::IsolateData* isolate_data = new bin::IsolateData(name, NULL, NULL);
|
| + char* err;
|
| + Dart_Isolate isolate = Dart_CreateIsolate(
|
| + name, NULL, buffer, NULL, isolate_data, &err);
|
| + if (isolate == NULL) {
|
| + OS::Print("Creation of isolate failed '%s'\n", err);
|
| + free(err);
|
| + }
|
| + EXPECT(isolate != NULL);
|
| + return isolate;
|
| +}
|
| +
|
| +
|
| static const char* kPackageScheme = "package:";
|
|
|
| static bool IsPackageSchemeURL(const char* url_name) {
|
| @@ -56,12 +73,11 @@ static bool IsPackageSchemeURL(const char* url_name) {
|
| return (strncmp(url_name, kPackageScheme, kPackageSchemeLen) == 0);
|
| }
|
|
|
| -static Dart_Handle ResolvePackageUri(Dart_Handle builtin_lib,
|
| - const char* uri_chars) {
|
| +static Dart_Handle ResolvePackageUri(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,
|
| + return Dart_Invoke(DartUtils::BuiltinLib(),
|
| DartUtils::NewString("_filePathFromUri"),
|
| kNumArgs,
|
| dart_args);
|
| @@ -88,10 +104,6 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
|
| return result;
|
| }
|
|
|
| - Dart_Handle builtin_lib =
|
| - Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
|
| - DART_CHECK_VALID(builtin_lib);
|
| -
|
| bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_chars);
|
| bool is_io_library = DartUtils::IsDartIOLibURL(library_url_string);
|
| if (tag == Dart_kCanonicalizeUrl) {
|
| @@ -105,7 +117,7 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
|
| if (Dart_IsError(library_url)) {
|
| return library_url;
|
| }
|
| - return DartUtils::ResolveUri(library_url, url, builtin_lib);
|
| + return DartUtils::ResolveUri(library_url, url);
|
| }
|
| if (is_dart_scheme_url) {
|
| ASSERT(tag == Dart_kImportTag);
|
| @@ -113,7 +125,7 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
|
| if (DartUtils::IsDartIOLibURL(url_chars)) {
|
| return Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
|
| } else if (DartUtils::IsDartBuiltinLibURL(url_chars)) {
|
| - return builtin_lib;
|
| + return Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
|
| } else {
|
| return DartUtils::NewError("Do not know how to load '%s'", url_chars);
|
| }
|
| @@ -127,7 +139,7 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
|
| 0, 0);
|
| }
|
| if (IsPackageSchemeURL(url_chars)) {
|
| - Dart_Handle resolved_uri = ResolvePackageUri(builtin_lib, url_chars);
|
| + Dart_Handle resolved_uri = ResolvePackageUri(url_chars);
|
| DART_CHECK_VALID(resolved_uri);
|
| url_chars = NULL;
|
| Dart_Handle result = Dart_StringToCString(resolved_uri, &url_chars);
|
|
|