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

Side by Side Diff: runtime/vm/unit_test.cc

Issue 693183006: Revert "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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | sdk/bin/dart2js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "vm/unit_test.h" 5 #include "vm/unit_test.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 30 matching lines...) Expand all
41 41
42 42
43 void TestCaseBase::RunAll() { 43 void TestCaseBase::RunAll() {
44 TestCaseBase* test = first_; 44 TestCaseBase* test = first_;
45 while (test != NULL) { 45 while (test != NULL) {
46 test->RunTest(); 46 test->RunTest();
47 test = test->next_; 47 test = test->next_;
48 } 48 }
49 } 49 }
50 50
51 static const char* kPackageScheme = "package:";
52
53 static bool IsPackageSchemeURL(const char* url_name) {
54 static const intptr_t kPackageSchemeLen = strlen(kPackageScheme);
55 return (strncmp(url_name, kPackageScheme, kPackageSchemeLen) == 0);
56 }
57
58 static Dart_Handle ResolvePackageUri(Dart_Handle builtin_lib,
59 const char* uri_chars) {
60 const int kNumArgs = 1;
61 Dart_Handle dart_args[kNumArgs];
62 dart_args[0] = DartUtils::NewString(uri_chars);
63 return Dart_Invoke(builtin_lib,
64 DartUtils::NewString("_filePathFromUri"),
65 kNumArgs,
66 dart_args);
67 }
68 51
69 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, 52 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
70 Dart_Handle library, 53 Dart_Handle library,
71 Dart_Handle url) { 54 Dart_Handle url) {
72 if (!Dart_IsLibrary(library)) { 55 if (!Dart_IsLibrary(library)) {
73 return Dart_NewApiError("not a library"); 56 return Dart_NewApiError("not a library");
74 } 57 }
75 if (!Dart_IsString(url)) { 58 if (!Dart_IsString(url)) {
76 return Dart_NewApiError("url is not a string"); 59 return Dart_NewApiError("url is not a string");
77 } 60 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 101 }
119 } 102 }
120 if (is_io_library) { 103 if (is_io_library) {
121 ASSERT(tag == Dart_kSourceTag); 104 ASSERT(tag == Dart_kSourceTag);
122 return Dart_LoadSource(library, 105 return Dart_LoadSource(library,
123 url, 106 url,
124 Builtin::PartSource(Builtin::kIOLibrary, 107 Builtin::PartSource(Builtin::kIOLibrary,
125 url_chars), 108 url_chars),
126 0, 0); 109 0, 0);
127 } 110 }
128 if (IsPackageSchemeURL(url_chars)) {
129 Dart_Handle resolved_uri = ResolvePackageUri(builtin_lib, url_chars);
130 DART_CHECK_VALID(resolved_uri);
131 url_chars = NULL;
132 Dart_Handle result = Dart_StringToCString(resolved_uri, &url_chars);
133 if (Dart_IsError(result)) {
134 return Dart_NewApiError("accessing url characters failed");
135 }
136 }
137 // Do sync loading since unit_test doesn't support async. 111 // Do sync loading since unit_test doesn't support async.
138 Dart_Handle source = DartUtils::ReadStringFromFile(url_chars); 112 Dart_Handle source = DartUtils::ReadStringFromFile(url_chars);
139 EXPECT_VALID(source); 113 EXPECT_VALID(source);
140 if (tag == Dart_kImportTag) { 114 if (tag == Dart_kImportTag) {
141 return Dart_LoadLibrary(url, source, 0, 0); 115 return Dart_LoadLibrary(url, source, 0, 0);
142 } else { 116 } else {
143 ASSERT(tag == Dart_kSourceTag); 117 ASSERT(tag == Dart_kSourceTag);
144 return Dart_LoadSource(library, url, source, 0, 0); 118 return Dart_LoadSource(library, url, source, 0, 0);
145 } 119 }
146 } 120 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 Isolate* isolate = Isolate::Current(); 251 Isolate* isolate = Isolate::Current();
278 ASSERT(isolate != NULL); 252 ASSERT(isolate != NULL);
279 ASSERT(ClassFinalizer::AllClassesFinalized()); 253 ASSERT(ClassFinalizer::AllClassesFinalized());
280 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, 254 const Error& error = Error::Handle(Compiler::CompileFunction(isolate,
281 function)); 255 function));
282 return error.IsNull(); 256 return error.IsNull();
283 } 257 }
284 258
285 259
286 } // namespace dart 260 } // namespace dart
OLDNEW
« 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