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

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

Issue 270503007: Eliminate unused url mapping parameter in dartutils (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months 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/unit_test.h ('k') | no next file » | 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 bool is_io_library = DartUtils::IsDartIOLibURL(library_url_string); 74 bool is_io_library = DartUtils::IsDartIOLibURL(library_url_string);
75 if (tag == Dart_kCanonicalizeUrl) { 75 if (tag == Dart_kCanonicalizeUrl) {
76 // If this is a Dart Scheme URL then it is not modified as it will be 76 // If this is a Dart Scheme URL then it is not modified as it will be
77 // handled by the VM internally. 77 // handled by the VM internally.
78 if (is_dart_scheme_url || is_io_library) { 78 if (is_dart_scheme_url || is_io_library) {
79 return url; 79 return url;
80 } 80 }
81 Dart_Handle builtin_lib = 81 Dart_Handle builtin_lib =
82 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 82 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
83 DART_CHECK_VALID(builtin_lib); 83 DART_CHECK_VALID(builtin_lib);
84 return DartUtils::CanonicalizeURL(NULL, library, url_chars); 84
85 Dart_Handle library_url = Dart_LibraryUrl(library);
86 if (Dart_IsError(library_url)) {
87 return library_url;
88 }
89 return DartUtils::ResolveUri(library_url, url, builtin_lib);
85 } 90 }
86 if (is_dart_scheme_url) { 91 if (is_dart_scheme_url) {
87 ASSERT(tag == Dart_kImportTag); 92 ASSERT(tag == Dart_kImportTag);
88 // Handle imports of other built-in libraries present in the SDK. 93 // Handle imports of other built-in libraries present in the SDK.
89 if (DartUtils::IsDartIOLibURL(url_chars)) { 94 if (DartUtils::IsDartIOLibURL(url_chars)) {
90 return Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); 95 return Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
91 } else if (DartUtils::IsDartBuiltinLibURL(url_chars)) { 96 } else if (DartUtils::IsDartBuiltinLibURL(url_chars)) {
92 return Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 97 return Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
93 } else { 98 } else {
94 return DartUtils::NewError("Do not know how to load '%s'", url_chars); 99 return DartUtils::NewError("Do not know how to load '%s'", url_chars);
95 } 100 }
96 } 101 }
97 if (is_io_library) { 102 if (is_io_library) {
98 ASSERT(tag == Dart_kSourceTag); 103 ASSERT(tag == Dart_kSourceTag);
99 return Dart_LoadSource(library, 104 return Dart_LoadSource(library,
100 url, 105 url,
101 Builtin::PartSource(Builtin::kIOLibrary, 106 Builtin::PartSource(Builtin::kIOLibrary,
102 url_chars)); 107 url_chars));
103 } 108 }
104 return DartUtils::LoadSource(NULL, 109 return DartUtils::LoadSource(library, url, tag, url_chars);
105 library,
106 url,
107 tag,
108 url_chars);
109 } 110 }
110 111
111 112
112 Dart_Handle TestCase::LoadTestScript(const char* script, 113 Dart_Handle TestCase::LoadTestScript(const char* script,
113 Dart_NativeEntryResolver resolver) { 114 Dart_NativeEntryResolver resolver,
114 Dart_Handle url = NewString(TestCase::url()); 115 const char* lib_url) {
116 Dart_Handle url = NewString(lib_url);
115 Dart_Handle source = NewString(script); 117 Dart_Handle source = NewString(script);
116 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); 118 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler);
117 EXPECT_VALID(result); 119 EXPECT_VALID(result);
118 EXPECT_VALID(result); 120 EXPECT_VALID(result);
119 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); 121 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0);
120 DART_CHECK_VALID(lib); 122 DART_CHECK_VALID(lib);
121 result = Dart_SetNativeResolver(lib, resolver, NULL); 123 result = Dart_SetNativeResolver(lib, resolver, NULL);
122 DART_CHECK_VALID(result); 124 DART_CHECK_VALID(result);
123 return lib; 125 return lib;
124 } 126 }
125 127
126 128
129 Dart_Handle TestCase::LoadCoreTestScript(const char* script,
130 Dart_NativeEntryResolver resolver) {
131 return LoadTestScript(script, resolver, CORELIB_TEST_URI);
132 }
133
134
127 Dart_Handle TestCase::lib() { 135 Dart_Handle TestCase::lib() {
128 Dart_Handle url = NewString(TestCase::url()); 136 Dart_Handle url = NewString(TestCase::url());
129 Dart_Handle lib = Dart_LookupLibrary(url); 137 Dart_Handle lib = Dart_LookupLibrary(url);
130 DART_CHECK_VALID(lib); 138 DART_CHECK_VALID(lib);
131 ASSERT(Dart_IsLibrary(lib)); 139 ASSERT(Dart_IsLibrary(lib));
132 return lib; 140 return lib;
133 } 141 }
134 142
135 143
136 Dart_Handle TestCase::library_handler(Dart_LibraryTag tag, 144 Dart_Handle TestCase::library_handler(Dart_LibraryTag tag,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bool CompilerTest::TestCompileFunction(const Function& function) { 240 bool CompilerTest::TestCompileFunction(const Function& function) {
233 Isolate* isolate = Isolate::Current(); 241 Isolate* isolate = Isolate::Current();
234 ASSERT(isolate != NULL); 242 ASSERT(isolate != NULL);
235 ASSERT(ClassFinalizer::AllClassesFinalized()); 243 ASSERT(ClassFinalizer::AllClassesFinalized());
236 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 244 const Error& error = Error::Handle(Compiler::CompileFunction(function));
237 return error.IsNull(); 245 return error.IsNull();
238 } 246 }
239 247
240 248
241 } // namespace dart 249 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/unit_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698