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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 10963009: Fix implicit super constructor calls for sub-classes of native field wrappers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « no previous file | runtime/vm/parser.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
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index ed6cb7ca1445617139a4dc891a3a67793ee7208d..52e37bc0fa7651894acd95aef084c16b0454bcfc 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -3042,6 +3042,36 @@ TEST_CASE(InjectNativeFields4) {
}
+TEST_CASE(InjectNativeFieldsSuperClass) {
+ const char* kScriptChars =
+ "#import('dart:nativewrappers');"
+ "class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n"
+ " NativeFieldsSuper() : fld1 = 42 {}\n"
+ " int fld1;\n"
+ "}\n"
+ "class NativeFields extends NativeFieldsSuper {\n"
+ " fld() => fld1;\n"
+ "}\n"
+ "int testMain() {\n"
+ " NativeFields obj = new NativeFields();\n"
+ " return obj.fld();\n"
+ "}\n";
+ Dart_Handle result;
+ // Load up a test script in the test library.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_field_lookup);
+
+ // Invoke a function which returns an object of type NativeFields.
+ result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+
+ EXPECT_VALID(result);
+ EXPECT(Dart_IsInteger(result));
+ int64_t value = 0;
+ result = Dart_IntegerToInt64(result, &value);
+ EXPECT_VALID(result);
+ EXPECT_EQ(42, value);
+}
+
+
static void TestNativeFields(Dart_Handle retobj) {
// Access and set various instance fields of the object.
Dart_Handle result = Dart_GetField(retobj, Dart_NewString("fld3"));
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698