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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 9372024: Add missing backref collection when reading mint and bigint objects in a native message handler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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_message.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index b24fe317c0636187c77f01ea17ce4ac4688b5099..0bafa2fd7b6bc188d55f5b4e42fb676fbaea619e 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -1305,6 +1305,18 @@ UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) {
" for (var i = 0; i < kArrayLength; i++) list[i] = s;\n"
" return list;\n"
"}\n"
+ "getMintList() {\n"
+ " var mint = 0x7FFFFFFFFFFFFFFF;\n"
+ " var list = new List(kArrayLength);\n"
+ " for (var i = 0; i < kArrayLength; i++) list[i] = mint;\n"
+ " return list;\n"
+ "}\n"
+ "getBigintList() {\n"
+ " var bigint = 0x1234567890123456789012345678901234567890;\n"
+ " var list = new List(kArrayLength);\n"
+ " for (var i = 0; i < kArrayLength; i++) list[i] = bigint;\n"
+ " return list;\n"
+ "}\n"
"getDoubleList() {\n"
" var d = 3.14;\n"
" var list = new List<double>(kArrayLength);\n"
@@ -1358,6 +1370,32 @@ UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) {
}
}
{
+ // Generate a list of medium ints from Dart code.
+ ApiNativeScope scope;
+ Dart_CObject* root = GetDeserializedDartMessage(lib, "getMintList");
+ EXPECT_NOTNULL(root);
+ EXPECT_EQ(Dart_CObject::kArray, root->type);
+ EXPECT_EQ(kArrayLength, root->value.as_array.length);
+ for (int i = 0; i < kArrayLength; i++) {
+ Dart_CObject* element = root->value.as_array.values[i];
+ EXPECT_EQ(root->value.as_array.values[0], element);
+ EXPECT_EQ(Dart_CObject::kInt64, element->type);
+ }
+ }
+ {
+ // Generate a list of bigints from Dart code.
+ ApiNativeScope scope;
+ Dart_CObject* root = GetDeserializedDartMessage(lib, "getBigintList");
+ EXPECT_NOTNULL(root);
+ EXPECT_EQ(Dart_CObject::kArray, root->type);
+ EXPECT_EQ(kArrayLength, root->value.as_array.length);
+ for (int i = 0; i < kArrayLength; i++) {
+ Dart_CObject* element = root->value.as_array.values[i];
+ EXPECT_EQ(root->value.as_array.values[0], element);
+ EXPECT_EQ(Dart_CObject::kBigint, element->type);
+ }
+ }
+ {
// Generate a list of doubles from Dart code.
ApiNativeScope scope;
Dart_CObject* root = GetDeserializedDartMessage(lib, "getDoubleList");
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698