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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 529053002: Make Dart API Dart_IsTypedData work for typed data views (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « runtime/vm/dart_api_impl.cc ('k') | no next file » | 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 9fe96ae2f070cf54890e12d7738af7e03e684e65..4b0b5d51fccaf47a031352c86564b57888497486 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -1417,6 +1417,29 @@ TEST_CASE(TypedDataViewListGetAsBytes) {
}
+TEST_CASE(TypedDataViewListIsTypedData) {
+ const int kSize = 1000;
+
+ const char* kScriptChars =
+ "import 'dart:typed_data';\n"
+ "List main(int size) {\n"
+ " var a = new Int8List(size);\n"
+ " var view = new Int8List.view(a.buffer, 0, size);\n"
+ " return view;\n"
+ "}\n";
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+
+ // Create a typed data view object.
+ Dart_Handle dart_args[1];
+ dart_args[0] = Dart_NewInteger(kSize);
+ Dart_Handle view_obj = Dart_Invoke(lib, NewString("main"), 1, dart_args);
+ EXPECT_VALID(view_obj);
+ // Test that the API considers it a TypedData object.
+ EXPECT(Dart_IsTypedData(view_obj));
+}
+
+
TEST_CASE(TypedDataAccess) {
EXPECT_EQ(Dart_TypedData_kInvalid,
Dart_GetTypeOfTypedData(Dart_True()));
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698