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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 11968022: Lookup functions by name that contains the private key, except for dart_api which allows ignoring t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 17175)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -3617,6 +3617,15 @@
}
+static Dart_Handle PrivateLibName(Dart_Handle lib, const char* str) {
+ EXPECT(Dart_IsLibrary(lib));
+ Isolate* isolate = Isolate::Current();
+ const Library& library_obj = Api::UnwrapLibraryHandle(isolate, lib);
+ const String& name = String::Handle(String::New(str));
+ return Api::NewHandle(isolate, library_obj.PrivateName(name));
+}
+
+
TEST_CASE(Invoke) {
const char* kScriptChars =
"class BaseMethods {\n"
@@ -3666,8 +3675,7 @@
EXPECT_ERROR(Dart_Invoke(instance, name, 2, bad_args),
"did not find instance method 'Methods.instanceMethod'");
- // Hidden instance method.
- name = NewString("_instanceMethod");
+ name = PrivateLibName(lib, "_instanceMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
result = Dart_Invoke(instance, name, 1, args);
@@ -3698,7 +3706,7 @@
"did not find static method 'Methods.staticMethod'");
// Hidden static method.
- name = NewString("_staticMethod");
+ name = PrivateLibName(lib, "_staticMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(cls, name, 1, args);
@@ -3727,7 +3735,7 @@
"2 passed, 1 expected.");
// Hidden top-level method.
- name = NewString("_topMethod");
+ name = PrivateLibName(lib, "_topMethod");
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(lib, name, 1, args);
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698