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

Unified Diff: runtime/vm/object_test.cc

Issue 18242003: Add a VM defined class MirrorReference as an opaque pointer for Dart code to VM internal objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/object_store.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 24693)
+++ runtime/vm/object_test.cc (working copy)
@@ -3179,6 +3179,32 @@
}
+TEST_CASE(MirrorReference) {
+ const MirrorReference& reference =
+ MirrorReference::Handle(MirrorReference::New());
+ Object& initial_referent = Object::Handle(reference.referent());
+ EXPECT(initial_referent.IsNull());
+
+ Library& library = Library::Handle(Library::CoreLibrary());
+ EXPECT(!library.IsNull());
+ EXPECT(library.IsLibrary());
+ reference.set_referent(library);
+ const Object& returned_referent = Object::Handle(reference.referent());
+ EXPECT(returned_referent.IsLibrary());
+ EXPECT_EQ(returned_referent.raw(), library.raw());
+
+ const MirrorReference& other_reference =
+ MirrorReference::Handle(MirrorReference::New());
+ EXPECT_NE(reference.raw(), other_reference.raw());
+ other_reference.set_referent(library);
+ EXPECT_NE(reference.raw(), other_reference.raw());
+ EXPECT_EQ(reference.referent(), other_reference.referent());
+
+ Object& obj = Object::Handle(reference.raw());
+ ASSERT(obj.IsMirrorReference());
+}
+
+
static RawFunction* GetFunction(const Class& cls, const char* name) {
const Function& result = Function::Handle(cls.LookupDynamicFunction(
String::Handle(String::New(name))));
« no previous file with comments | « runtime/vm/object_store.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698