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

Unified Diff: vm/dart_entry_test.cc

Issue 11613009: Changed the API in DartEntry for invoking dart code from C++ to make it more compatible with the re… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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
« vm/dart_entry.h ('K') | « vm/dart_entry.cc ('k') | vm/debugger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_entry_test.cc
===================================================================
--- vm/dart_entry_test.cc (revision 16285)
+++ vm/dart_entry_test.cc (working copy)
@@ -39,12 +39,9 @@
EXPECT(CompilerTest::TestCompileFunction(function));
EXPECT(function.HasCode());
- GrowableArray<const Object*> arguments;
- const Array& kNoArgumentNames = Array::Handle();
+ const Array& args = Array::Handle(Object::empty_array());
const Smi& retval = Smi::Handle(
- reinterpret_cast<RawSmi*>(DartEntry::InvokeStatic(function,
- arguments,
- kNoArgumentNames)));
+ reinterpret_cast<RawSmi*>(DartEntry::InvokeStatic(function, args)));
EXPECT_EQ(Smi::New(42), retval.raw());
}
@@ -69,9 +66,9 @@
Function& function = Function::Handle(cls.LookupStaticFunction(name));
EXPECT(!function.IsNull());
GrowableArray<const Object*> arguments;
- const Array& kNoArgumentNames = Array::Handle();
- const Object& retval = Object::Handle(
- DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
+ const Array& args = Array::Handle(Object::empty_array());
+ const Object& retval = Object::Handle(DartEntry::InvokeStatic(function,
+ args));
EXPECT(retval.IsError());
EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString());
}
@@ -96,24 +93,24 @@
// Invoke the constructor.
const Instance& instance = Instance::Handle(Instance::New(cls));
- GrowableArray<const Object*> constructor_arguments(2);
- constructor_arguments.Add(&instance);
- constructor_arguments.Add(&Smi::Handle(Smi::New(Function::kCtorPhaseAll)));
+ const Array& constructor_arguments = Array::Handle(Array::New(2));
+ constructor_arguments.SetAt(0, instance);
+ constructor_arguments.SetAt(
+ 1, Smi::Handle(Smi::New(Function::kCtorPhaseAll)));
String& constructor_name = String::Handle(Symbols::New("A."));
Function& constructor =
- Function::Handle(cls.LookupConstructor(constructor_name));
+ Function::Handle(cls.LookupConstructor(constructor_name));
ASSERT(!constructor.IsNull());
- const Array& kNoArgumentNames = Array::Handle();
- DartEntry::InvokeStatic(constructor, constructor_arguments, kNoArgumentNames);
+ DartEntry::InvokeStatic(constructor, constructor_arguments);
// Call foo.
String& name = String::Handle(String::New("foo"));
Function& function = Function::Handle(cls.LookupDynamicFunction(name));
EXPECT(!function.IsNull());
- GrowableArray<const Object*> arguments;
- const Object& retval = Object::Handle(
- DartEntry::InvokeDynamic(
- instance, function, arguments, kNoArgumentNames));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, instance);
+ const Object& retval = Object::Handle(DartEntry::InvokeDynamic(function,
+ args));
EXPECT(retval.IsError());
EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString());
}
« vm/dart_entry.h ('K') | « vm/dart_entry.cc ('k') | vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698