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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 22632010: Added following dart API changes to enable more efficient access based (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/isolate.h » ('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 26045)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -542,6 +542,16 @@
intptr_t len = -1;
EXPECT_VALID(Dart_StringLength(latin1str, &len));
EXPECT_EQ(4, len);
+ intptr_t char_size;
+ intptr_t str_len;
+ void* peer;
+ EXPECT_VALID(Dart_StringGetProperties(latin1str,
+ &char_size,
+ &str_len,
+ &peer));
+ EXPECT_EQ(1, char_size);
+ EXPECT_EQ(4, str_len);
+ EXPECT(!peer);
uint8_t data8[] = { 'o', 'n', 'e', 0x7F };
@@ -562,10 +572,17 @@
}
Dart_Handle ext8 = Dart_NewExternalLatin1String(data8, ARRAY_SIZE(data8),
- NULL, NULL);
+ data8, NULL);
EXPECT_VALID(ext8);
EXPECT(Dart_IsString(ext8));
EXPECT(Dart_IsExternalString(ext8));
+ EXPECT_VALID(Dart_StringGetProperties(ext8,
+ &char_size,
+ &str_len,
+ &peer));
+ EXPECT_EQ(1, char_size);
+ EXPECT_EQ(4, str_len);
+ EXPECT_EQ(data8, peer);
uint16_t data16[] = { 't', 'w', 'o', 0xFFFF };
@@ -574,12 +591,26 @@
EXPECT(Dart_IsString(str16));
EXPECT(!Dart_IsStringLatin1(str16));
EXPECT(!Dart_IsExternalString(str16));
+ EXPECT_VALID(Dart_StringGetProperties(str16,
+ &char_size,
+ &str_len,
+ &peer));
+ EXPECT_EQ(2, char_size);
+ EXPECT_EQ(4, str_len);
+ EXPECT(!peer);
Dart_Handle ext16 = Dart_NewExternalUTF16String(data16, ARRAY_SIZE(data16),
- NULL, NULL);
+ data16, NULL);
EXPECT_VALID(ext16);
EXPECT(Dart_IsString(ext16));
EXPECT(Dart_IsExternalString(ext16));
+ EXPECT_VALID(Dart_StringGetProperties(ext16,
+ &char_size,
+ &str_len,
+ &peer));
+ EXPECT_EQ(2, char_size);
+ EXPECT_EQ(4, str_len);
+ EXPECT_EQ(data16, peer);
int32_t data32[] = { 'f', 'o', 'u', 'r', 0x10FFFF };
@@ -7105,8 +7136,15 @@
Dart_EnterScope();
Dart_Handle str = Dart_GetNativeArgument(args, 0);
EXPECT(Dart_IsString(str));
+ void* peer;
+ Dart_Handle str_arg = Dart_GetNativeStringArgument(args, 0, &peer);
+ EXPECT(Dart_IsString(str_arg));
+ EXPECT(!peer);
intptr_t size = 0;
EXPECT_VALID(Dart_StringStorageSize(str, &size));
+ intptr_t arg_size = 0;
+ EXPECT_VALID(Dart_StringStorageSize(str_arg, &arg_size));
+ EXPECT_EQ(size, arg_size);
char* str_data = new char[size];
Dart_Handle result =
Dart_MakeExternalString(str,
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698