| Index: runtime/vm/dart_api_impl_test.cc
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl_test.cc (revision 43765)
|
| +++ runtime/vm/dart_api_impl_test.cc (working copy)
|
| @@ -20,6 +20,7 @@
|
| namespace dart {
|
|
|
| DECLARE_FLAG(bool, enable_type_checks);
|
| +DECLARE_FLAG(bool, verify_acquired_data);
|
|
|
| TEST_CASE(ErrorHandleBasics) {
|
| const char* kScriptChars =
|
| @@ -1741,7 +1742,7 @@
|
| }
|
|
|
|
|
| -TEST_CASE(TypedDataDirectAccess) {
|
| +static void TestTypedDataDirectAccess() {
|
| Dart_Handle str = Dart_NewStringFromCString("junk");
|
| Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10);
|
| EXPECT_VALID(byte_array);
|
| @@ -1774,6 +1775,18 @@
|
| }
|
|
|
|
|
| +TEST_CASE(TypedDataDirectAccessUnverified) {
|
| + FLAG_verify_acquired_data = false;
|
| + TestTypedDataDirectAccess();
|
| +}
|
| +
|
| +
|
| +TEST_CASE(TypedDataDirectAccessVerified) {
|
| + FLAG_verify_acquired_data = true;
|
| + TestTypedDataDirectAccess();
|
| +}
|
| +
|
| +
|
| static void TestDirectAccess(Dart_Handle lib,
|
| Dart_Handle array,
|
| Dart_TypedData_Type expected_type) {
|
| @@ -1815,7 +1828,7 @@
|
| }
|
|
|
|
|
| -TEST_CASE(TypedDataDirectAccess1) {
|
| +static void TestTypedDataDirectAccess1() {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| "class Expect {\n"
|
| @@ -1860,7 +1873,19 @@
|
| }
|
|
|
|
|
| -TEST_CASE(TypedDataViewDirectAccess) {
|
| +TEST_CASE(TypedDataDirectAccess1Unverified) {
|
| + FLAG_verify_acquired_data = false;
|
| + TestTypedDataDirectAccess1();
|
| +}
|
| +
|
| +
|
| +TEST_CASE(TypedDataDirectAccess1Verified) {
|
| + FLAG_verify_acquired_data = true;
|
| + TestTypedDataDirectAccess1();
|
| +}
|
| +
|
| +
|
| +static void TestTypedDataViewDirectAccess() {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| "class Expect {\n"
|
| @@ -1899,7 +1924,19 @@
|
| }
|
|
|
|
|
| -TEST_CASE(ByteDataDirectAccess) {
|
| +TEST_CASE(TypedDataViewDirectAccessUnverified) {
|
| + FLAG_verify_acquired_data = false;
|
| + TestTypedDataViewDirectAccess();
|
| +}
|
| +
|
| +
|
| +TEST_CASE(TypedDataViewDirectAccessVerified) {
|
| + FLAG_verify_acquired_data = true;
|
| + TestTypedDataViewDirectAccess();
|
| +}
|
| +
|
| +
|
| +static void TestByteDataDirectAccess() {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| "class Expect {\n"
|
| @@ -1938,6 +1975,18 @@
|
| }
|
|
|
|
|
| +TEST_CASE(ByteDataDirectAccessUnverified) {
|
| + FLAG_verify_acquired_data = false;
|
| + TestByteDataDirectAccess();
|
| +}
|
| +
|
| +
|
| +TEST_CASE(ByteDataDirectAccessVerified) {
|
| + FLAG_verify_acquired_data = true;
|
| + TestByteDataDirectAccess();
|
| +}
|
| +
|
| +
|
| static void ExternalTypedDataAccessTests(Dart_Handle obj,
|
| Dart_TypedData_Type expected_type,
|
| uint8_t data[],
|
|
|