| 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 006b77f9d532e7cf4114683e2cd6b3ec524f36e0..60ff7cc45175886143c6a720e6e805a8d7dab3f0 100644
|
| --- a/runtime/vm/dart_api_impl_test.cc
|
| +++ b/runtime/vm/dart_api_impl_test.cc
|
| @@ -2,8 +2,8 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +#include "vm/dart_api_impl.h"
|
| #include "bin/builtin.h"
|
| -#include "vm/compiler.h"
|
| #include "include/dart_api.h"
|
| #include "include/dart_mirrors_api.h"
|
| #include "include/dart_native_api.h"
|
| @@ -12,7 +12,7 @@
|
| #include "platform/text_buffer.h"
|
| #include "platform/utils.h"
|
| #include "vm/class_finalizer.h"
|
| -#include "vm/dart_api_impl.h"
|
| +#include "vm/compiler.h"
|
| #include "vm/dart_api_state.h"
|
| #include "vm/lockers.h"
|
| #include "vm/timeline.h"
|
| @@ -64,7 +64,6 @@ TEST_CASE(ErrorHandleBasics) {
|
| EXPECT_VALID(Dart_ErrorGetStackTrace(exception));
|
| }
|
|
|
| -
|
| TEST_CASE(StackTraceInfo) {
|
| const char* kScriptChars =
|
| "bar() => throw new Error();\n"
|
| @@ -135,7 +134,6 @@ TEST_CASE(StackTraceInfo) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(DeepStackTraceInfo) {
|
| const char* kScriptChars =
|
| "foo(n) => n == 1 ? throw new Error() : foo(n-1);\n"
|
| @@ -214,7 +212,6 @@ TEST_CASE(DeepStackTraceInfo) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(StackOverflowStackTraceInfo) {
|
| const char* kScriptChars =
|
| "class C {\n"
|
| @@ -263,7 +260,6 @@ TEST_CASE(StackOverflowStackTraceInfo) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(OutOfMemoryStackTraceInfo) {
|
| const char* kScriptChars =
|
| "var number_of_ints = 134000000;\n"
|
| @@ -281,7 +277,6 @@ TEST_CASE(OutOfMemoryStackTraceInfo) {
|
| EXPECT(Dart_IsError(result)); // No StackTrace for OutOfMemory.
|
| }
|
|
|
| -
|
| void CurrentStackTraceNative(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
|
|
| @@ -369,7 +364,6 @@ void CurrentStackTraceNative(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction CurrentStackTraceNativeLookup(
|
| Dart_Handle name,
|
| int argument_count,
|
| @@ -379,7 +373,6 @@ static Dart_NativeFunction CurrentStackTraceNativeLookup(
|
| return reinterpret_cast<Dart_NativeFunction>(&CurrentStackTraceNative);
|
| }
|
|
|
| -
|
| TEST_CASE(CurrentStackTraceInfo) {
|
| const char* kScriptChars =
|
| "inspectStack() native 'CurrentStackTraceNatve';\n"
|
| @@ -396,10 +389,8 @@ TEST_CASE(CurrentStackTraceInfo) {
|
| EXPECT_EQ(42, value);
|
| }
|
|
|
| -
|
| #endif // !PRODUCT
|
|
|
| -
|
| TEST_CASE(ErrorHandleTypes) {
|
| const String& compile_message = String::Handle(String::New("CompileError"));
|
| const String& fatal_message = String::Handle(String::New("FatalError"));
|
| @@ -451,7 +442,6 @@ TEST_CASE(ErrorHandleTypes) {
|
| EXPECT_STREQ("FatalError", Dart_GetError(fatal_error));
|
| }
|
|
|
| -
|
| TEST_CASE(UnhandleExceptionError) {
|
| const char* exception_cstr = "";
|
|
|
| @@ -501,14 +491,12 @@ TEST_CASE(UnhandleExceptionError) {
|
| EXPECT_STREQ(kRegularString, exception_cstr);
|
| }
|
|
|
| -
|
| // Should we propagate the error via Dart_SetReturnValue?
|
| static bool use_set_return = false;
|
|
|
| // Should we propagate the error via Dart_ThrowException?
|
| static bool use_throw_exception = false;
|
|
|
| -
|
| void PropagateErrorNative(Dart_NativeArguments args) {
|
| Dart_Handle closure = Dart_GetNativeArgument(args, 0);
|
| EXPECT(Dart_IsClosure(closure));
|
| @@ -527,7 +515,6 @@ void PropagateErrorNative(Dart_NativeArguments args) {
|
| }
|
| }
|
|
|
| -
|
| static Dart_NativeFunction PropagateError_native_lookup(
|
| Dart_Handle name,
|
| int argument_count,
|
| @@ -537,7 +524,6 @@ static Dart_NativeFunction PropagateError_native_lookup(
|
| return reinterpret_cast<Dart_NativeFunction>(&PropagateErrorNative);
|
| }
|
|
|
| -
|
| TEST_CASE(Dart_PropagateError) {
|
| const char* kScriptChars =
|
| "raiseCompileError() {\n"
|
| @@ -601,14 +587,12 @@ TEST_CASE(Dart_PropagateError) {
|
| EXPECT_SUBSTRING("myException", Dart_GetError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(Dart_Error) {
|
| Dart_Handle error = Api::NewError("An %s", "error");
|
| EXPECT(Dart_IsError(error));
|
| EXPECT_STREQ("An error", Dart_GetError(error));
|
| }
|
|
|
| -
|
| TEST_CASE(Null) {
|
| Dart_Handle null = Dart_Null();
|
| EXPECT_VALID(null);
|
| @@ -619,14 +603,12 @@ TEST_CASE(Null) {
|
| EXPECT(!Dart_IsNull(str));
|
| }
|
|
|
| -
|
| TEST_CASE(EmptyString) {
|
| Dart_Handle empty = Dart_EmptyString();
|
| EXPECT_VALID(empty);
|
| EXPECT(!Dart_IsNull(empty));
|
| }
|
|
|
| -
|
| TEST_CASE(IdentityEquals) {
|
| Dart_Handle five = Dart_NewInteger(5);
|
| Dart_Handle five_again = Dart_NewInteger(5);
|
| @@ -677,7 +659,6 @@ TEST_CASE(IdentityEquals) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(IdentityHash) {
|
| Dart_Handle five = Dart_NewInteger(5);
|
| Dart_Handle five_again = Dart_NewInteger(5);
|
| @@ -718,7 +699,6 @@ TEST_CASE(IdentityHash) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ObjectEquals) {
|
| bool equal = false;
|
| Dart_Handle five = NewString("5");
|
| @@ -743,7 +723,6 @@ TEST_CASE(ObjectEquals) {
|
| EXPECT(!equal);
|
| }
|
|
|
| -
|
| TEST_CASE(InstanceValues) {
|
| EXPECT(Dart_IsInstance(NewString("test")));
|
| EXPECT(Dart_IsInstance(Dart_True()));
|
| @@ -752,7 +731,6 @@ TEST_CASE(InstanceValues) {
|
| EXPECT(!Dart_IsInstance(Dart_Null()));
|
| }
|
|
|
| -
|
| TEST_CASE(InstanceGetType) {
|
| Zone* zone = thread->zone();
|
| // Get the handle from a valid instance handle.
|
| @@ -795,7 +773,6 @@ TEST_CASE(InstanceGetType) {
|
| "type Instance.");
|
| }
|
|
|
| -
|
| TEST_CASE(BooleanValues) {
|
| Dart_Handle str = NewString("test");
|
| EXPECT(!Dart_IsBoolean(str));
|
| @@ -819,7 +796,6 @@ TEST_CASE(BooleanValues) {
|
| EXPECT(!value);
|
| }
|
|
|
| -
|
| TEST_CASE(BooleanConstants) {
|
| Dart_Handle true_handle = Dart_True();
|
| EXPECT_VALID(true_handle);
|
| @@ -839,7 +815,6 @@ TEST_CASE(BooleanConstants) {
|
| EXPECT(!value);
|
| }
|
|
|
| -
|
| TEST_CASE(DoubleValues) {
|
| const double kDoubleVal1 = 201.29;
|
| const double kDoubleVal2 = 101.19;
|
| @@ -856,7 +831,6 @@ TEST_CASE(DoubleValues) {
|
| EXPECT_EQ(kDoubleVal2, out2);
|
| }
|
|
|
| -
|
| TEST_CASE(NumberValues) {
|
| // TODO(antonm): add various kinds of ints (smi, mint, bigint).
|
| const char* kScriptChars =
|
| @@ -889,7 +863,6 @@ TEST_CASE(NumberValues) {
|
| EXPECT(!Dart_IsNumber(result));
|
| }
|
|
|
| -
|
| TEST_CASE(IntegerValues) {
|
| const int64_t kIntegerVal1 = 100;
|
| const int64_t kIntegerVal2 = 0xffffffff;
|
| @@ -943,7 +916,6 @@ TEST_CASE(IntegerValues) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(IntegerFitsIntoInt64) {
|
| Dart_Handle max = Dart_NewInteger(kMaxInt64);
|
| EXPECT(Dart_IsInteger(max));
|
| @@ -974,7 +946,6 @@ TEST_CASE(IntegerFitsIntoInt64) {
|
| EXPECT(!fits);
|
| }
|
|
|
| -
|
| TEST_CASE(IntegerFitsIntoUint64) {
|
| Dart_Handle max = Dart_NewIntegerFromUint64(kMaxUint64);
|
| EXPECT(Dart_IsInteger(max));
|
| @@ -1005,7 +976,6 @@ TEST_CASE(IntegerFitsIntoUint64) {
|
| EXPECT(!fits);
|
| }
|
|
|
| -
|
| TEST_CASE(ArrayValues) {
|
| EXPECT(!Dart_IsList(Dart_Null()));
|
| const int kArrayLength = 10;
|
| @@ -1042,7 +1012,6 @@ TEST_CASE(ArrayValues) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(IsString) {
|
| uint8_t latin1[] = {'o', 'n', 'e', 0xC2, 0xA2};
|
|
|
| @@ -1121,7 +1090,6 @@ TEST_CASE(IsString) {
|
| EXPECT(!Dart_IsExternalString(str32));
|
| }
|
|
|
| -
|
| TEST_CASE(NewString) {
|
| const char* ascii = "string";
|
| Dart_Handle ascii_str = NewString(ascii);
|
| @@ -1143,7 +1111,6 @@ TEST_CASE(NewString) {
|
| EXPECT(Dart_IsError(invalid_str));
|
| }
|
|
|
| -
|
| TEST_CASE(MalformedStringToUTF8) {
|
| // 1D11E = treble clef
|
| // [0] should be high surrogate D834
|
| @@ -1189,7 +1156,6 @@ TEST_CASE(MalformedStringToUTF8) {
|
| }
|
| }
|
|
|
| -
|
| // Helper class to ensure new gen GC is triggered without any side effects.
|
| // The normal call to CollectGarbage(Heap::kNew) could potentially trigger
|
| // an old gen collection if there is a promotion failure and this could
|
| @@ -1211,12 +1177,10 @@ class GCTestHelper : public AllStatic {
|
| }
|
| };
|
|
|
| -
|
| static void ExternalStringCallbackFinalizer(void* peer) {
|
| *static_cast<int*>(peer) *= 2;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringCallback) {
|
| int peer8 = 40;
|
| int peer16 = 41;
|
| @@ -1252,7 +1216,6 @@ TEST_CASE(ExternalStringCallback) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringPretenure) {
|
| {
|
| Dart_EnterScope();
|
| @@ -1292,7 +1255,6 @@ TEST_CASE(ExternalStringPretenure) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalTypedDataPretenure) {
|
| {
|
| Dart_EnterScope();
|
| @@ -1321,7 +1283,6 @@ TEST_CASE(ExternalTypedDataPretenure) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ListAccess) {
|
| const char* kScriptChars =
|
| "List testMain() {"
|
| @@ -1472,7 +1433,6 @@ TEST_CASE(ListAccess) {
|
| EXPECT(Dart_IsUnhandledExceptionError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(MapAccess) {
|
| EXPECT(!Dart_IsMap(Dart_Null()));
|
| const char* kScriptChars =
|
| @@ -1565,7 +1525,6 @@ TEST_CASE(MapAccess) {
|
| EXPECT(Dart_IsError(Dart_MapKeys(a)));
|
| }
|
|
|
| -
|
| TEST_CASE(IsFuture) {
|
| const char* kScriptChars =
|
| "import 'dart:async';"
|
| @@ -1591,7 +1550,6 @@ TEST_CASE(IsFuture) {
|
| EXPECT(!Dart_IsFuture(null));
|
| }
|
|
|
| -
|
| TEST_CASE(TypedDataViewListGetAsBytes) {
|
| const int kSize = 1000;
|
|
|
| @@ -1624,7 +1582,6 @@ TEST_CASE(TypedDataViewListGetAsBytes) {
|
| delete[] data;
|
| }
|
|
|
| -
|
| TEST_CASE(TypedDataViewListIsTypedData) {
|
| const int kSize = 1000;
|
|
|
| @@ -1647,7 +1604,6 @@ TEST_CASE(TypedDataViewListIsTypedData) {
|
| EXPECT(Dart_IsTypedData(view_obj));
|
| }
|
|
|
| -
|
| TEST_CASE(TypedDataAccess) {
|
| EXPECT_EQ(Dart_TypedData_kInvalid, Dart_GetTypeOfTypedData(Dart_True()));
|
| EXPECT_EQ(Dart_TypedData_kInvalid,
|
| @@ -1721,7 +1677,6 @@ TEST_CASE(TypedDataAccess) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ByteBufferAccess) {
|
| EXPECT(!Dart_IsByteBuffer(Dart_True()));
|
| Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10);
|
| @@ -1765,7 +1720,6 @@ TEST_CASE(ByteBufferAccess) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| static int kLength = 16;
|
|
|
| static void ByteDataNativeFunction(Dart_NativeArguments args) {
|
| @@ -1777,7 +1731,6 @@ static void ByteDataNativeFunction(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name,
|
| int arg_count,
|
| bool* auto_setup_scope) {
|
| @@ -1786,7 +1739,6 @@ static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name,
|
| return &ByteDataNativeFunction;
|
| }
|
|
|
| -
|
| TEST_CASE(ByteDataAccess) {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| @@ -1822,7 +1774,6 @@ TEST_CASE(ByteDataAccess) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| static const intptr_t kExtLength = 16;
|
| static int8_t data[kExtLength] = {
|
| 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
|
| @@ -1840,7 +1791,6 @@ static void ExternalByteDataNativeFunction(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction ExternalByteDataNativeResolver(
|
| Dart_Handle name,
|
| int arg_count,
|
| @@ -1850,7 +1800,6 @@ static Dart_NativeFunction ExternalByteDataNativeResolver(
|
| return &ExternalByteDataNativeFunction;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalByteDataAccess) {
|
| // TODO(asiva): Once we have getInt16LE and getInt16BE support use the
|
| // appropriate getter instead of the host endian format used now.
|
| @@ -1897,10 +1846,8 @@ TEST_CASE(ExternalByteDataAccess) {
|
| }
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
|
|
| -
|
| static const intptr_t kOptExtLength = 16;
|
| static int8_t opt_data[kOptExtLength] = {
|
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
| @@ -1918,7 +1865,6 @@ static void OptExternalByteDataNativeFunction(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction OptExternalByteDataNativeResolver(
|
| Dart_Handle name,
|
| int arg_count,
|
| @@ -1928,7 +1874,6 @@ static Dart_NativeFunction OptExternalByteDataNativeResolver(
|
| return &OptExternalByteDataNativeFunction;
|
| }
|
|
|
| -
|
| TEST_CASE(OptimizedExternalByteDataAccess) {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| @@ -1970,10 +1915,8 @@ TEST_CASE(OptimizedExternalByteDataAccess) {
|
| FLAG_optimization_counter_threshold = old_oct;
|
| }
|
|
|
| -
|
| #endif // !PRODUCT
|
|
|
| -
|
| static void TestTypedDataDirectAccess() {
|
| Dart_Handle str = Dart_NewStringFromCString("junk");
|
| Dart_Handle byte_array = Dart_NewTypedData(Dart_TypedData_kUint8, 10);
|
| @@ -2013,19 +1956,16 @@ static void TestTypedDataDirectAccess() {
|
| " to be of type 'TypedData'.");
|
| }
|
|
|
| -
|
| 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,
|
| @@ -2076,7 +2016,6 @@ static void TestDirectAccess(Dart_Handle lib,
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| static void TestTypedDataDirectAccess1() {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| @@ -2121,19 +2060,16 @@ static void TestTypedDataDirectAccess1() {
|
| TestDirectAccess(lib, ext_list_access_test_obj, Dart_TypedData_kUint8, true);
|
| }
|
|
|
| -
|
| 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"
|
| @@ -2172,19 +2108,16 @@ static void TestTypedDataViewDirectAccess() {
|
| TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8, false);
|
| }
|
|
|
| -
|
| 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"
|
| @@ -2223,19 +2156,16 @@ static void TestByteDataDirectAccess() {
|
| TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kByteData, false);
|
| }
|
|
|
| -
|
| 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[],
|
| @@ -2292,7 +2222,6 @@ static void ExternalTypedDataAccessTests(Dart_Handle obj,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalTypedDataAccess) {
|
| uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77};
|
| intptr_t data_length = ARRAY_SIZE(data);
|
| @@ -2302,7 +2231,6 @@ TEST_CASE(ExternalTypedDataAccess) {
|
| ExternalTypedDataAccessTests(obj, Dart_TypedData_kUint8, data, data_length);
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalClampedTypedDataAccess) {
|
| uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77};
|
| intptr_t data_length = ARRAY_SIZE(data);
|
| @@ -2313,7 +2241,6 @@ TEST_CASE(ExternalClampedTypedDataAccess) {
|
| data_length);
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalUint8ClampedArrayAccess) {
|
| const char* kScriptChars =
|
| "testClamped(List a) {\n"
|
| @@ -2348,26 +2275,22 @@ TEST_CASE(ExternalUint8ClampedArrayAccess) {
|
| EXPECT(value);
|
| }
|
|
|
| -
|
| static void NopCallback(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {}
|
|
|
| -
|
| static void UnreachedCallback(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| static void ExternalTypedDataFinalizer(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {
|
| *static_cast<int*>(peer) = 42;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalTypedDataCallback) {
|
| int peer = 0;
|
| {
|
| @@ -2392,7 +2315,6 @@ TEST_CASE(ExternalTypedDataCallback) {
|
| }
|
| }
|
|
|
| -
|
| static void SlowFinalizer(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {
|
| @@ -2401,7 +2323,6 @@ static void SlowFinalizer(void* isolate_callback_data,
|
| (*count)++;
|
| }
|
|
|
| -
|
| TEST_CASE(SlowFinalizer) {
|
| intptr_t count = 0;
|
| for (intptr_t i = 0; i < 10; i++) {
|
| @@ -2426,7 +2347,6 @@ TEST_CASE(SlowFinalizer) {
|
| EXPECT_EQ(20, count);
|
| }
|
|
|
| -
|
| static void CheckFloat32x4Data(Dart_Handle obj) {
|
| void* raw_data = NULL;
|
| intptr_t len;
|
| @@ -2441,7 +2361,6 @@ static void CheckFloat32x4Data(Dart_Handle obj) {
|
| EXPECT_VALID(Dart_TypedDataReleaseData(obj));
|
| }
|
|
|
| -
|
| TEST_CASE(Float32x4List) {
|
| const char* kScriptChars =
|
| "import 'dart:typed_data';\n"
|
| @@ -2483,7 +2402,6 @@ TEST_CASE(Float32x4List) {
|
| }
|
| }
|
|
|
| -
|
| // Unit test for entering a scope, creating a local handle and exiting
|
| // the scope.
|
| VM_UNIT_TEST_CASE(EnterExitScope) {
|
| @@ -2506,7 +2424,6 @@ VM_UNIT_TEST_CASE(EnterExitScope) {
|
| EXPECT(scope == thread->api_top_scope());
|
| }
|
|
|
| -
|
| // Unit test for creating and deleting persistent handles.
|
| VM_UNIT_TEST_CASE(PersistentHandles) {
|
| const char* kTestString1 = "Test String1";
|
| @@ -2574,7 +2491,6 @@ VM_UNIT_TEST_CASE(PersistentHandles) {
|
| Dart_ShutdownIsolate();
|
| }
|
|
|
| -
|
| // Test that we are able to create a persistent handle from a
|
| // persistent handle.
|
| VM_UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) {
|
| @@ -2606,7 +2522,6 @@ VM_UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) {
|
| EXPECT(value);
|
| }
|
|
|
| -
|
| // Test that we can assign to a persistent handle.
|
| VM_UNIT_TEST_CASE(AssignToPersistentHandle) {
|
| const char* kTestString1 = "Test String1";
|
| @@ -2640,21 +2555,17 @@ VM_UNIT_TEST_CASE(AssignToPersistentHandle) {
|
| EXPECT(Dart_IsNull(obj));
|
| }
|
|
|
| -
|
| static Dart_Handle AsHandle(Dart_PersistentHandle weak) {
|
| return Dart_HandleFromPersistent(weak);
|
| }
|
|
|
| -
|
| static Dart_Handle AsHandle(Dart_WeakPersistentHandle weak) {
|
| return Dart_HandleFromWeakPersistent(weak);
|
| }
|
|
|
| -
|
| static Dart_WeakPersistentHandle weak_new_ref = NULL;
|
| static Dart_WeakPersistentHandle weak_old_ref = NULL;
|
|
|
| -
|
| static void WeakPersistentHandleCallback(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {
|
| @@ -2665,7 +2576,6 @@ static void WeakPersistentHandleCallback(void* isolate_callback_data,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandle) {
|
| Dart_Handle local_new_ref = Dart_Null();
|
| weak_new_ref = Dart_NewWeakPersistentHandle(local_new_ref, NULL, 0,
|
| @@ -2786,7 +2696,6 @@ TEST_CASE(WeakPersistentHandle) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleErrors) {
|
| Dart_EnterScope();
|
|
|
| @@ -2807,14 +2716,12 @@ TEST_CASE(WeakPersistentHandleErrors) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void WeakPersistentHandlePeerFinalizer(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {
|
| *static_cast<int*>(peer) = 42;
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleCallback) {
|
| Dart_WeakPersistentHandle weak_ref = NULL;
|
| int peer = 0;
|
| @@ -2838,7 +2745,6 @@ TEST_CASE(WeakPersistentHandleCallback) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleNoCallback) {
|
| Dart_WeakPersistentHandle weak_ref = NULL;
|
| int peer = 0;
|
| @@ -2865,7 +2771,6 @@ TEST_CASE(WeakPersistentHandleNoCallback) {
|
| }
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) {
|
| TestCase::CreateTestIsolate();
|
| Dart_EnterScope();
|
| @@ -2878,7 +2783,6 @@ VM_UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) {
|
| EXPECT(peer == 42);
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleExternalAllocationSize) {
|
| Heap* heap = Isolate::Current()->heap();
|
| EXPECT(heap->ExternalInWords(Heap::kNew) == 0);
|
| @@ -2931,7 +2835,6 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSize) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleExternalAllocationSizeNewspaceGC) {
|
| Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current());
|
| Heap* heap = Isolate::Current()->heap();
|
| @@ -2975,7 +2878,6 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeNewspaceGC) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) {
|
| // Check that external allocation in old space can trigger GC.
|
| Isolate* isolate = Isolate::Current();
|
| @@ -3005,7 +2907,6 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| TEST_CASE(WeakPersistentHandleExternalAllocationSizeOddReferents) {
|
| Heap* heap = Isolate::Current()->heap();
|
| Dart_WeakPersistentHandle weak1 = NULL;
|
| @@ -3041,12 +2942,10 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeOddReferents) {
|
| }
|
| }
|
|
|
| -
|
| static Dart_WeakPersistentHandle weak1 = NULL;
|
| static Dart_WeakPersistentHandle weak2 = NULL;
|
| static Dart_WeakPersistentHandle weak3 = NULL;
|
|
|
| -
|
| static void ImplicitReferencesCallback(void* isolate_callback_data,
|
| Dart_WeakPersistentHandle handle,
|
| void* peer) {
|
| @@ -3059,7 +2958,6 @@ static void ImplicitReferencesCallback(void* isolate_callback_data,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ImplicitReferencesOldSpace) {
|
| Dart_PersistentHandle strong = NULL;
|
| Dart_WeakPersistentHandle strong_weak = NULL;
|
| @@ -3125,12 +3023,10 @@ TEST_CASE(ImplicitReferencesOldSpace) {
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(ImplicitReferencesNewSpace) {
|
| Dart_PersistentHandle strong = NULL;
|
| Dart_WeakPersistentHandle strong_weak = NULL;
|
|
|
| -
|
| Dart_EnterScope();
|
| {
|
| CHECK_API_SCOPE(thread);
|
| @@ -3191,36 +3087,28 @@ TEST_CASE(ImplicitReferencesNewSpace) {
|
| }
|
| }
|
|
|
| -
|
| static int global_prologue_callback_status;
|
|
|
| -
|
| static void PrologueCallbackTimes2() {
|
| global_prologue_callback_status *= 2;
|
| }
|
|
|
| -
|
| static void PrologueCallbackTimes3() {
|
| global_prologue_callback_status *= 3;
|
| }
|
|
|
| -
|
| static int global_epilogue_callback_status;
|
|
|
| -
|
| static void EpilogueCallbackNOP() {}
|
|
|
| -
|
| static void EpilogueCallbackTimes4() {
|
| global_epilogue_callback_status *= 4;
|
| }
|
|
|
| -
|
| static void EpilogueCallbackTimes5() {
|
| global_epilogue_callback_status *= 5;
|
| }
|
|
|
| -
|
| TEST_CASE(SetGarbageCollectionCallbacks) {
|
| // GC callback addition testing.
|
|
|
| @@ -3250,7 +3138,6 @@ TEST_CASE(SetGarbageCollectionCallbacks) {
|
| EXPECT(Dart_IsError(Dart_SetGcCallbacks(NULL, &EpilogueCallbackTimes4)));
|
| }
|
|
|
| -
|
| TEST_CASE(SingleGarbageCollectionCallback) {
|
| // Add a prologue callback.
|
| EXPECT_VALID(
|
| @@ -3359,7 +3246,6 @@ TEST_CASE(SingleGarbageCollectionCallback) {
|
| }
|
| }
|
|
|
| -
|
| // Unit test for creating multiple scopes and local handles within them.
|
| // Ensure that the local handles get all cleaned out when exiting the
|
| // scope.
|
| @@ -3423,7 +3309,6 @@ VM_UNIT_TEST_CASE(LocalHandles) {
|
| Dart_ShutdownIsolate();
|
| }
|
|
|
| -
|
| // Unit test for creating multiple scopes and allocating objects in the
|
| // zone for the scope. Ensure that the memory is freed when the scope
|
| // exits.
|
| @@ -3468,7 +3353,6 @@ VM_UNIT_TEST_CASE(LocalZoneMemory) {
|
| Dart_ShutdownIsolate();
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(Isolates) {
|
| // This test currently assumes that the Dart_Isolate type is an opaque
|
| // representation of Isolate*.
|
| @@ -3492,7 +3376,6 @@ VM_UNIT_TEST_CASE(Isolates) {
|
| EXPECT(NULL == Dart_CurrentIsolate());
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(CurrentIsolateData) {
|
| intptr_t mydata = 12345;
|
| char* err;
|
| @@ -3506,7 +3389,6 @@ VM_UNIT_TEST_CASE(CurrentIsolateData) {
|
| Dart_ShutdownIsolate();
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(IsolateSetCheckedMode) {
|
| const char* kScriptChars =
|
| "int bad1() {\n"
|
| @@ -3563,17 +3445,14 @@ VM_UNIT_TEST_CASE(IsolateSetCheckedMode) {
|
| Dart_ShutdownIsolate();
|
| }
|
|
|
| -
|
| TEST_CASE(DebugName) {
|
| Dart_Handle debug_name = Dart_DebugName();
|
| EXPECT_VALID(debug_name);
|
| EXPECT(Dart_IsString(debug_name));
|
| }
|
|
|
| -
|
| static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) {}
|
|
|
| -
|
| VM_UNIT_TEST_CASE(SetMessageCallbacks) {
|
| Dart_Isolate dart_isolate = TestCase::CreateTestIsolate();
|
| Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback);
|
| @@ -3582,7 +3461,6 @@ VM_UNIT_TEST_CASE(SetMessageCallbacks) {
|
| Dart_ShutdownIsolate();
|
| }
|
|
|
| -
|
| TEST_CASE(SetStickyError) {
|
| const char* kScriptChars = "main() => throw 'HI';";
|
| Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
|
| @@ -3599,7 +3477,6 @@ TEST_CASE(SetStickyError) {
|
| EXPECT(Dart_GetStickyError() == Dart_Null());
|
| }
|
|
|
| -
|
| TEST_CASE(TypeGetNonParamtericTypes) {
|
| const char* kScriptChars =
|
| "class MyClass0 {\n"
|
| @@ -3691,7 +3568,6 @@ TEST_CASE(TypeGetNonParamtericTypes) {
|
| EXPECT(Dart_IdentityEquals(type2, type2_obj));
|
| }
|
|
|
| -
|
| TEST_CASE(TypeGetParameterizedTypes) {
|
| const char* kScriptChars =
|
| "class MyClass0<A, B> {\n"
|
| @@ -3795,7 +3671,6 @@ TEST_CASE(TypeGetParameterizedTypes) {
|
| EXPECT(!Dart_IdentityEquals(type1_obj, myclass1_type));
|
| }
|
|
|
| -
|
| static void TestFieldOk(Dart_Handle container,
|
| Dart_Handle name,
|
| bool final,
|
| @@ -3833,13 +3708,11 @@ static void TestFieldOk(Dart_Handle container,
|
| }
|
| }
|
|
|
| -
|
| static void TestFieldNotFound(Dart_Handle container, Dart_Handle name) {
|
| EXPECT(Dart_IsError(Dart_GetField(container, name)));
|
| EXPECT(Dart_IsError(Dart_SetField(container, name, Dart_Null())));
|
| }
|
|
|
| -
|
| TEST_CASE(FieldAccess) {
|
| const char* kScriptChars =
|
| "class BaseFields {\n"
|
| @@ -4091,7 +3964,6 @@ TEST_CASE(FieldAccess) {
|
| TestFieldNotFound(lib, name);
|
| }
|
|
|
| -
|
| TEST_CASE(SetField_FunnyValue) {
|
| const char* kScriptChars = "var top;\n";
|
|
|
| @@ -4125,12 +3997,10 @@ TEST_CASE(SetField_FunnyValue) {
|
| EXPECT_STREQ("myerror", Dart_GetError(result));
|
| }
|
|
|
| -
|
| void NativeFieldLookup(Dart_NativeArguments args) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction native_field_lookup(Dart_Handle name,
|
| int argument_count,
|
| bool* auto_setup_scope) {
|
| @@ -4139,7 +4009,6 @@ static Dart_NativeFunction native_field_lookup(Dart_Handle name,
|
| return reinterpret_cast<Dart_NativeFunction>(&NativeFieldLookup);
|
| }
|
|
|
| -
|
| TEST_CASE(InjectNativeFields1) {
|
| const char* kScriptChars =
|
| "class NativeFields extends NativeFieldsWrapper {\n"
|
| @@ -4191,7 +4060,6 @@ TEST_CASE(InjectNativeFields1) {
|
| EXPECT_EQ(kNumNativeFields, cls.num_native_fields());
|
| }
|
|
|
| -
|
| TEST_CASE(InjectNativeFields2) {
|
| const char* kScriptChars =
|
| "class NativeFields extends NativeFieldsWrapper {\n"
|
| @@ -4219,7 +4087,6 @@ TEST_CASE(InjectNativeFields2) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(InjectNativeFields3) {
|
| const char* kScriptChars =
|
| "import 'dart:nativewrappers';"
|
| @@ -4261,7 +4128,6 @@ TEST_CASE(InjectNativeFields3) {
|
| EXPECT_EQ(kNumNativeFields, cls.num_native_fields());
|
| }
|
|
|
| -
|
| TEST_CASE(InjectNativeFields4) {
|
| const char* kScriptChars =
|
| "import 'dart:nativewrappers';"
|
| @@ -4297,7 +4163,6 @@ TEST_CASE(InjectNativeFields4) {
|
| #endif
|
| }
|
|
|
| -
|
| static const int kTestNumNativeFields = 2;
|
| static const intptr_t kNativeField1Value = 30;
|
| static const intptr_t kNativeField2Value = 40;
|
| @@ -4308,7 +4173,6 @@ void TestNativeFieldsAccess_init(Dart_NativeArguments args) {
|
| Dart_SetNativeInstanceField(receiver, 1, kNativeField2Value);
|
| }
|
|
|
| -
|
| void TestNativeFieldsAccess_access(Dart_NativeArguments args) {
|
| intptr_t field_values[kTestNumNativeFields];
|
| Dart_Handle result = Dart_GetNativeFieldsOfArgument(
|
| @@ -4323,7 +4187,6 @@ void TestNativeFieldsAccess_access(Dart_NativeArguments args) {
|
| EXPECT_EQ(0, field_values[1]);
|
| }
|
|
|
| -
|
| static Dart_NativeFunction TestNativeFieldsAccess_lookup(Dart_Handle name,
|
| int argument_count,
|
| bool* auto_scope) {
|
| @@ -4345,7 +4208,6 @@ static Dart_NativeFunction TestNativeFieldsAccess_lookup(Dart_Handle name,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(TestNativeFieldsAccess) {
|
| const char* kScriptChars =
|
| "import 'dart:nativewrappers';"
|
| @@ -4374,7 +4236,6 @@ TEST_CASE(TestNativeFieldsAccess) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| TEST_CASE(InjectNativeFieldsSuperClass) {
|
| const char* kScriptChars =
|
| "import 'dart:nativewrappers';"
|
| @@ -4404,7 +4265,6 @@ TEST_CASE(InjectNativeFieldsSuperClass) {
|
| 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, NewString("fld3"));
|
| @@ -4480,7 +4340,6 @@ static void TestNativeFields(Dart_Handle retobj) {
|
| EXPECT_EQ(20, value);
|
| }
|
|
|
| -
|
| TEST_CASE(NativeFieldAccess) {
|
| const char* kScriptChars =
|
| "class NativeFields extends NativeFieldsWrapper {\n"
|
| @@ -4530,7 +4389,6 @@ TEST_CASE(NativeFieldAccess) {
|
| EXPECT_STREQ("myerror", Dart_GetError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(ImplicitNativeFieldAccess) {
|
| const char* kScriptChars =
|
| "import 'dart:nativewrappers';"
|
| @@ -4557,7 +4415,6 @@ TEST_CASE(ImplicitNativeFieldAccess) {
|
| TestNativeFields(retobj);
|
| }
|
|
|
| -
|
| TEST_CASE(NegativeNativeFieldAccess) {
|
| const char* kScriptChars =
|
| "class NativeFields {\n"
|
| @@ -4629,7 +4486,6 @@ TEST_CASE(NegativeNativeFieldAccess) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(NegativeNativeFieldInIsolateMessage) {
|
| const char* kScriptChars =
|
| "import 'dart:isolate';\n"
|
| @@ -4667,7 +4523,6 @@ TEST_CASE(NegativeNativeFieldInIsolateMessage) {
|
| EXPECT(Dart_IsError(retobj));
|
| }
|
|
|
| -
|
| TEST_CASE(GetStaticField_RunsInitializer) {
|
| const char* kScriptChars =
|
| "class TestClass {\n"
|
| @@ -4709,7 +4564,6 @@ TEST_CASE(GetStaticField_RunsInitializer) {
|
| EXPECT_EQ(13, value);
|
| }
|
|
|
| -
|
| TEST_CASE(GetField_CheckIsolate) {
|
| const char* kScriptChars =
|
| "class TestClass {\n"
|
| @@ -4731,7 +4585,6 @@ TEST_CASE(GetField_CheckIsolate) {
|
| EXPECT_EQ(11, value);
|
| }
|
|
|
| -
|
| TEST_CASE(SetField_CheckIsolate) {
|
| const char* kScriptChars =
|
| "class TestClass {\n"
|
| @@ -4756,7 +4609,6 @@ TEST_CASE(SetField_CheckIsolate) {
|
| EXPECT_EQ(13, value);
|
| }
|
|
|
| -
|
| TEST_CASE(New) {
|
| const char* kScriptChars =
|
| "class MyClass {\n"
|
| @@ -4988,7 +4840,6 @@ TEST_CASE(New) {
|
| EXPECT(!instanceOf);
|
| }
|
|
|
| -
|
| TEST_CASE(New_Issue2971) {
|
| // Issue 2971: We were unable to use Dart_New to construct an
|
| // instance of List, due to problems implementing interface
|
| @@ -5006,7 +4857,6 @@ TEST_CASE(New_Issue2971) {
|
| EXPECT(Dart_IsList(list_obj));
|
| }
|
|
|
| -
|
| static Dart_Handle PrivateLibName(Dart_Handle lib, const char* str) {
|
| EXPECT(Dart_IsLibrary(lib));
|
| Thread* thread = Thread::Current();
|
| @@ -5015,7 +4865,6 @@ static Dart_Handle PrivateLibName(Dart_Handle lib, const char* str) {
|
| return Api::NewHandle(thread, library_obj.PrivateName(name));
|
| }
|
|
|
| -
|
| TEST_CASE(Invoke) {
|
| const char* kScriptChars =
|
| "class BaseMethods {\n"
|
| @@ -5135,7 +4984,6 @@ TEST_CASE(Invoke) {
|
| EXPECT_STREQ("hidden top !!!", str);
|
| }
|
|
|
| -
|
| TEST_CASE(Invoke_PrivateStatic) {
|
| const char* kScriptChars =
|
| "class Methods {\n"
|
| @@ -5161,7 +5009,6 @@ TEST_CASE(Invoke_PrivateStatic) {
|
| EXPECT_STREQ("hidden static !!!", str);
|
| }
|
|
|
| -
|
| TEST_CASE(Invoke_FunnyArgs) {
|
| const char* kScriptChars = "test(arg) => 'hello $arg';\n";
|
|
|
| @@ -5208,7 +5055,6 @@ TEST_CASE(Invoke_FunnyArgs) {
|
| EXPECT_STREQ("myerror", Dart_GetError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(Invoke_Null) {
|
| Dart_Handle result = Dart_Invoke(Dart_Null(), NewString("toString"), 0, NULL);
|
| EXPECT_VALID(result);
|
| @@ -5224,7 +5070,6 @@ TEST_CASE(Invoke_Null) {
|
| EXPECT(Dart_ErrorHasException(result));
|
| }
|
|
|
| -
|
| TEST_CASE(InvokeNoSuchMethod) {
|
| const char* kScriptChars =
|
| "import 'dart:_internal' as _internal;\n"
|
| @@ -5289,7 +5134,6 @@ TEST_CASE(InvokeNoSuchMethod) {
|
| EXPECT_EQ(3, value);
|
| }
|
|
|
| -
|
| TEST_CASE(Invoke_CrossLibrary) {
|
| const char* kLibrary1Chars =
|
| "library library1_name;\n"
|
| @@ -5328,7 +5172,6 @@ TEST_CASE(Invoke_CrossLibrary) {
|
| "did not find top-level function '_imported'");
|
| }
|
|
|
| -
|
| TEST_CASE(InvokeClosure) {
|
| const char* kScriptChars =
|
| "class InvokeClosure {\n"
|
| @@ -5395,14 +5238,12 @@ TEST_CASE(InvokeClosure) {
|
| EXPECT(Dart_ErrorHasException(result));
|
| }
|
|
|
| -
|
| void ExceptionNative(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| Dart_ThrowException(NewString("Hello from ExceptionNative!"));
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction native_lookup(Dart_Handle name,
|
| int argument_count,
|
| bool* auto_setup_scope) {
|
| @@ -5411,7 +5252,6 @@ static Dart_NativeFunction native_lookup(Dart_Handle name,
|
| return reinterpret_cast<Dart_NativeFunction>(&ExceptionNative);
|
| }
|
|
|
| -
|
| TEST_CASE(ThrowException) {
|
| const char* kScriptChars = "int test() native \"ThrowException_native\";";
|
| Dart_Handle result;
|
| @@ -5436,7 +5276,6 @@ TEST_CASE(ThrowException) {
|
| EXPECT_EQ(size, thread->ZoneSizeInBytes());
|
| }
|
|
|
| -
|
| static intptr_t kNativeArgumentNativeField1Value = 30;
|
| static intptr_t kNativeArgumentNativeField2Value = 40;
|
| static intptr_t native_arg_str_peer = 100;
|
| @@ -5459,7 +5298,6 @@ static void NativeArgumentCreate(Dart_NativeArguments args) {
|
| Dart_SetReturnValue(args, obj);
|
| }
|
|
|
| -
|
| static void NativeArgumentAccess(Dart_NativeArguments args) {
|
| const int kNumNativeFields = 2;
|
|
|
| @@ -5559,7 +5397,6 @@ static void NativeArgumentAccess(Dart_NativeArguments args) {
|
| Dart_SetIntegerReturnValue(args, 0);
|
| }
|
|
|
| -
|
| static Dart_NativeFunction native_args_lookup(Dart_Handle name,
|
| int argument_count,
|
| bool* auto_scope_setup) {
|
| @@ -5579,7 +5416,6 @@ static Dart_NativeFunction native_args_lookup(Dart_Handle name,
|
| return NULL;
|
| }
|
|
|
| -
|
| TEST_CASE(GetNativeArguments) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -5631,7 +5467,6 @@ TEST_CASE(GetNativeArguments) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| static void NativeArgumentCounter(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| int count = Dart_GetNativeArgumentCount(args);
|
| @@ -5639,7 +5474,6 @@ static void NativeArgumentCounter(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction gnac_lookup(Dart_Handle name,
|
| int argument_count,
|
| bool* auto_setup_scope) {
|
| @@ -5648,7 +5482,6 @@ static Dart_NativeFunction gnac_lookup(Dart_Handle name,
|
| return reinterpret_cast<Dart_NativeFunction>(&NativeArgumentCounter);
|
| }
|
|
|
| -
|
| TEST_CASE(GetNativeArgumentCount) {
|
| const char* kScriptChars =
|
| "class MyObject {"
|
| @@ -5672,7 +5505,6 @@ TEST_CASE(GetNativeArgumentCount) {
|
| EXPECT_EQ(3, value);
|
| }
|
|
|
| -
|
| TEST_CASE(GetType) {
|
| const char* kScriptChars =
|
| "library testlib;\n"
|
| @@ -5721,7 +5553,6 @@ TEST_CASE(GetType) {
|
| EXPECT_STREQ("myerror", Dart_GetError(type));
|
| }
|
|
|
| -
|
| TEST_CASE(InstanceOf) {
|
| const char* kScriptChars =
|
| "class OtherClass {\n"
|
| @@ -5787,7 +5618,6 @@ TEST_CASE(InstanceOf) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| static Dart_Handle library_handler(Dart_LibraryTag tag,
|
| Dart_Handle library,
|
| Dart_Handle url) {
|
| @@ -5797,7 +5627,6 @@ static Dart_Handle library_handler(Dart_LibraryTag tag,
|
| return Api::Success();
|
| }
|
|
|
| -
|
| TEST_CASE(LoadScript) {
|
| const char* kScriptChars =
|
| "main() {"
|
| @@ -5871,7 +5700,6 @@ TEST_CASE(LoadScript) {
|
| Dart_GetError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(RootLibrary) {
|
| const char* kScriptChars =
|
| "library testlib;"
|
| @@ -5903,7 +5731,6 @@ TEST_CASE(RootLibrary) {
|
| EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr));
|
| EXPECT_STREQ(TestCase::url(), uri_cstr);
|
|
|
| -
|
| Dart_Handle core_uri = Dart_NewStringFromCString("dart:core");
|
| Dart_Handle core_lib = Dart_LookupLibrary(core_uri);
|
| EXPECT_VALID(core_lib);
|
| @@ -5929,10 +5756,8 @@ TEST_CASE(RootLibrary) {
|
| EXPECT(Dart_IsNull(root_lib)); // Root library did change.
|
| }
|
|
|
| -
|
| static int index = 0;
|
|
|
| -
|
| static Dart_Handle import_library_handler(Dart_LibraryTag tag,
|
| Dart_Handle library,
|
| Dart_Handle url) {
|
| @@ -5966,7 +5791,6 @@ static Dart_Handle import_library_handler(Dart_LibraryTag tag,
|
| return Api::Success();
|
| }
|
|
|
| -
|
| TEST_CASE(LoadScript_CompileError) {
|
| const char* kScriptChars = ")";
|
| Dart_Handle url = NewString(TestCase::url());
|
| @@ -5978,7 +5802,6 @@ TEST_CASE(LoadScript_CompileError) {
|
| EXPECT(strstr(Dart_GetError(result), "unexpected token ')'"));
|
| }
|
|
|
| -
|
| TEST_CASE(LookupLibrary) {
|
| const char* kScriptChars =
|
| "import 'library1_dart';"
|
| @@ -6025,7 +5848,6 @@ TEST_CASE(LookupLibrary) {
|
| Dart_GetError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(LibraryName) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| Dart_Handle url = NewString("library1_url");
|
| @@ -6057,10 +5879,8 @@ TEST_CASE(LibraryName) {
|
| EXPECT_STREQ("library1_name", cstr);
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
|
|
| -
|
| TEST_CASE(LibraryId) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| Dart_Handle url = NewString("library1_url");
|
| @@ -6096,10 +5916,8 @@ TEST_CASE(LibraryId) {
|
| EXPECT_STREQ("library1_name", cstr);
|
| }
|
|
|
| -
|
| #endif // !PRODUCT
|
|
|
| -
|
| TEST_CASE(LibraryUrl) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| Dart_Handle url = NewString("library1_url");
|
| @@ -6131,7 +5949,6 @@ TEST_CASE(LibraryUrl) {
|
| EXPECT_STREQ("library1_url", cstr);
|
| }
|
|
|
| -
|
| TEST_CASE(LibraryGetClassNames) {
|
| const char* kLibraryChars =
|
| "library library_name;\n"
|
| @@ -6170,7 +5987,6 @@ TEST_CASE(LibraryGetClassNames) {
|
| EXPECT_STREQ("[A, B, C, _A, _B, _C]", list_cstr);
|
| }
|
|
|
| -
|
| TEST_CASE(GetFunctionNames) {
|
| const char* kLibraryChars =
|
| "library library_name;\n"
|
| @@ -6242,7 +6058,6 @@ TEST_CASE(GetFunctionNames) {
|
| EXPECT_STREQ("[A2, B2, C2=, MyClass, _A2, _B2, _C2=]", list_cstr);
|
| }
|
|
|
| -
|
| TEST_CASE(LibraryImportLibrary) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| const char* kLibrary2Chars = "library library2_name;";
|
| @@ -6297,7 +6112,6 @@ TEST_CASE(LibraryImportLibrary) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| TEST_CASE(ImportLibraryWithPrefix) {
|
| const char* kLibrary1Chars =
|
| "library library1_name;"
|
| @@ -6339,7 +6153,6 @@ TEST_CASE(ImportLibraryWithPrefix) {
|
| EXPECT_EQ(42, value);
|
| }
|
|
|
| -
|
| TEST_CASE(LoadLibrary) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| Dart_Handle error = Dart_NewApiError("incoming error");
|
| @@ -6400,7 +6213,6 @@ TEST_CASE(LoadLibrary) {
|
| Dart_GetError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(LoadLibrary_CompileError) {
|
| const char* kLibrary1Chars =
|
| "library library1_name;"
|
| @@ -6412,7 +6224,6 @@ TEST_CASE(LoadLibrary_CompileError) {
|
| EXPECT(strstr(Dart_GetError(result), "unexpected token ')'"));
|
| }
|
|
|
| -
|
| TEST_CASE(LoadSource) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| const char* kSourceChars = "part of library1_name;\n// Something innocuous";
|
| @@ -6502,7 +6313,6 @@ TEST_CASE(LoadSource) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(LoadSource_LateLoad) {
|
| const char* kLibrary1Chars =
|
| "library library1_name;\n"
|
| @@ -6552,7 +6362,6 @@ TEST_CASE(LoadSource_LateLoad) {
|
| EXPECT_STREQ("bar", result_cstr);
|
| }
|
|
|
| -
|
| TEST_CASE(LoadPatch) {
|
| const char* kLibrary1Chars = "library library1_name;";
|
| const char* kSourceChars =
|
| @@ -6703,14 +6512,12 @@ TEST_CASE(LoadPatchSignatureMismatch) {
|
| FLAG_ignore_patch_signature_mismatch = old_flag_value;
|
| }
|
|
|
| -
|
| static void PatchNativeFunction(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| Dart_SetReturnValue(args, Dart_Null());
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction PatchNativeResolver(Dart_Handle name,
|
| int arg_count,
|
| bool* auto_setup_scope) {
|
| @@ -6719,7 +6526,6 @@ static Dart_NativeFunction PatchNativeResolver(Dart_Handle name,
|
| return &PatchNativeFunction;
|
| }
|
|
|
| -
|
| TEST_CASE(ParsePatchLibrary) {
|
| const char* kLibraryChars =
|
| "library patched_library;\n"
|
| @@ -6890,21 +6696,18 @@ TEST_CASE(ParsePatchLibrary) {
|
| EXPECT_EQ(4, lib_scripts.Length());
|
| }
|
|
|
| -
|
| static void MyNativeFunction1(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| Dart_SetReturnValue(args, Dart_NewInteger(654321));
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void MyNativeFunction2(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| Dart_SetReturnValue(args, Dart_NewInteger(123456));
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction MyNativeResolver1(Dart_Handle name,
|
| int arg_count,
|
| bool* auto_setup_scope) {
|
| @@ -6913,7 +6716,6 @@ static Dart_NativeFunction MyNativeResolver1(Dart_Handle name,
|
| return &MyNativeFunction1;
|
| }
|
|
|
| -
|
| static Dart_NativeFunction MyNativeResolver2(Dart_Handle name,
|
| int arg_count,
|
| bool* auto_setup_scope) {
|
| @@ -6922,7 +6724,6 @@ static Dart_NativeFunction MyNativeResolver2(Dart_Handle name,
|
| return &MyNativeFunction2;
|
| }
|
|
|
| -
|
| TEST_CASE(SetNativeResolver) {
|
| const char* kScriptChars =
|
| "class Test {"
|
| @@ -7003,7 +6804,6 @@ TEST_CASE(SetNativeResolver) {
|
| "cannot be found");
|
| }
|
|
|
| -
|
| // Test that an imported name does not clash with the same name defined
|
| // in the importing library.
|
| TEST_CASE(ImportLibrary2) {
|
| @@ -7041,7 +6841,6 @@ TEST_CASE(ImportLibrary2) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| // Test that if the same name is imported from two libraries, it is
|
| // an error if that name is referenced.
|
| TEST_CASE(ImportLibrary3) {
|
| @@ -7081,7 +6880,6 @@ TEST_CASE(ImportLibrary3) {
|
| EXPECT_SUBSTRING("NoSuchMethodError", Dart_GetError(result));
|
| }
|
|
|
| -
|
| // Test that if the same name is imported from two libraries, it is
|
| // not an error if that name is not used.
|
| TEST_CASE(ImportLibrary4) {
|
| @@ -7118,7 +6916,6 @@ TEST_CASE(ImportLibrary4) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| TEST_CASE(ImportLibrary5) {
|
| const char* kScriptChars =
|
| "import 'lib.dart';\n"
|
| @@ -7149,7 +6946,6 @@ TEST_CASE(ImportLibrary5) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject* message) {
|
| // Gets a send port message.
|
| EXPECT_NOTNULL(message);
|
| @@ -7165,7 +6961,6 @@ void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject* message) {
|
| response);
|
| }
|
|
|
| -
|
| void NewNativePort_send321(Dart_Port dest_port_id, Dart_CObject* message) {
|
| // Gets a null message.
|
| EXPECT_NOTNULL(message);
|
| @@ -7181,21 +6976,18 @@ void NewNativePort_send321(Dart_Port dest_port_id, Dart_CObject* message) {
|
| response);
|
| }
|
|
|
| -
|
| TEST_CASE(IllegalNewSendPort) {
|
| Dart_Handle error = Dart_NewSendPort(ILLEGAL_PORT);
|
| EXPECT(Dart_IsError(error));
|
| EXPECT(Dart_IsApiError(error));
|
| }
|
|
|
| -
|
| TEST_CASE(IllegalPost) {
|
| Dart_Handle message = Dart_True();
|
| bool success = Dart_Post(ILLEGAL_PORT, message);
|
| EXPECT(!success);
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(NewNativePort) {
|
| // Create a port with a bogus handler.
|
| Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true);
|
| @@ -7255,7 +7047,6 @@ VM_UNIT_TEST_CASE(NewNativePort) {
|
| EXPECT(Dart_CloseNativePort(port_id2));
|
| }
|
|
|
| -
|
| void NewNativePort_sendInteger123(Dart_Port dest_port_id,
|
| Dart_CObject* message) {
|
| // Gets a send port message.
|
| @@ -7268,7 +7059,6 @@ void NewNativePort_sendInteger123(Dart_Port dest_port_id,
|
| 123);
|
| }
|
|
|
| -
|
| void NewNativePort_sendInteger321(Dart_Port dest_port_id,
|
| Dart_CObject* message) {
|
| // Gets a null message.
|
| @@ -7281,7 +7071,6 @@ void NewNativePort_sendInteger321(Dart_Port dest_port_id,
|
| 321);
|
| }
|
|
|
| -
|
| TEST_CASE(NativePortPostInteger) {
|
| const char* kScriptChars =
|
| "import 'dart:isolate';\n"
|
| @@ -7333,7 +7122,6 @@ TEST_CASE(NativePortPostInteger) {
|
| EXPECT(Dart_CloseNativePort(port_id2));
|
| }
|
|
|
| -
|
| void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id,
|
| Dart_CObject* message) {
|
| EXPECT_NOTNULL(message);
|
| @@ -7348,7 +7136,6 @@ void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(NativePortReceiveNull) {
|
| const char* kScriptChars =
|
| "import 'dart:isolate';\n"
|
| @@ -7386,7 +7173,6 @@ TEST_CASE(NativePortReceiveNull) {
|
| EXPECT(Dart_CloseNativePort(port_id1));
|
| }
|
|
|
| -
|
| void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id,
|
| Dart_CObject* message) {
|
| EXPECT_NOTNULL(message);
|
| @@ -7402,7 +7188,6 @@ void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(NativePortReceiveInteger) {
|
| const char* kScriptChars =
|
| "import 'dart:isolate';\n"
|
| @@ -7440,7 +7225,6 @@ TEST_CASE(NativePortReceiveInteger) {
|
| EXPECT(Dart_CloseNativePort(port_id1));
|
| }
|
|
|
| -
|
| static Dart_Isolate RunLoopTestCallback(const char* script_name,
|
| const char* main,
|
| const char* package_root,
|
| @@ -7486,7 +7270,6 @@ static Dart_Isolate RunLoopTestCallback(const char* script_name,
|
| return isolate;
|
| }
|
|
|
| -
|
| // Common code for RunLoop_Success/RunLoop_Failure.
|
| static void RunLoopTest(bool throw_exception) {
|
| Dart_IsolateCreateCallback saved = Isolate::CreateCallback();
|
| @@ -7517,23 +7300,19 @@ static void RunLoopTest(bool throw_exception) {
|
| Isolate::SetCreateCallback(saved);
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(RunLoop_Success) {
|
| RunLoopTest(false);
|
| }
|
|
|
| -
|
| VM_UNIT_TEST_CASE(RunLoop_Exception) {
|
| RunLoopTest(true);
|
| }
|
|
|
| -
|
| // Utility functions and variables for test case IsolateInterrupt starts here.
|
| static Monitor* sync = NULL;
|
| static Dart_Isolate shared_isolate = NULL;
|
| static bool main_entered = false;
|
|
|
| -
|
| void MarkMainEntered(Dart_NativeArguments args) {
|
| Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
|
| // Indicate that main has been entered.
|
| @@ -7546,7 +7325,6 @@ void MarkMainEntered(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction IsolateInterruptTestNativeLookup(
|
| Dart_Handle name,
|
| int argument_count,
|
| @@ -7556,7 +7334,6 @@ static Dart_NativeFunction IsolateInterruptTestNativeLookup(
|
| return reinterpret_cast<Dart_NativeFunction>(&MarkMainEntered);
|
| }
|
|
|
| -
|
| void BusyLoop_start(uword unused) {
|
| const char* kScriptChars =
|
| "class Native {\n"
|
| @@ -7610,7 +7387,6 @@ void BusyLoop_start(uword unused) {
|
| }
|
| }
|
|
|
| -
|
| static void* saved_callback_data;
|
| static void IsolateShutdownTestCallback(void* callback_data) {
|
| saved_callback_data = callback_data;
|
| @@ -7702,7 +7478,6 @@ VM_UNIT_TEST_CASE(IsolateShutdownRunDartCode) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| // The shutdown callback has not been called.
|
| EXPECT_EQ(0, add_result);
|
|
|
| @@ -7733,7 +7508,6 @@ static void NativeFoo1(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void NativeFoo2(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7756,7 +7530,6 @@ static void NativeFoo2(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void NativeFoo3(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7767,7 +7540,6 @@ static void NativeFoo3(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void NativeFoo4(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7780,7 +7552,6 @@ static void NativeFoo4(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name,
|
| int arg_count,
|
| bool* auto_setup_scope) {
|
| @@ -7809,7 +7580,6 @@ static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name,
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(NativeFunctionClosure) {
|
| const char* kScriptChars =
|
| "class Test {"
|
| @@ -7885,7 +7655,6 @@ TEST_CASE(NativeFunctionClosure) {
|
| EXPECT_EQ(0, value);
|
| }
|
|
|
| -
|
| static void StaticNativeFoo1(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7894,7 +7663,6 @@ static void StaticNativeFoo1(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void StaticNativeFoo2(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7904,7 +7672,6 @@ static void StaticNativeFoo2(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void StaticNativeFoo3(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7915,7 +7682,6 @@ static void StaticNativeFoo3(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static void StaticNativeFoo4(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| intptr_t i = Dart_GetNativeArgumentCount(args);
|
| @@ -7928,7 +7694,6 @@ static void StaticNativeFoo4(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction MyStaticNativeClosureResolver(
|
| Dart_Handle name,
|
| int arg_count,
|
| @@ -7958,7 +7723,6 @@ static Dart_NativeFunction MyStaticNativeClosureResolver(
|
| }
|
| }
|
|
|
| -
|
| TEST_CASE(NativeStaticFunctionClosure) {
|
| const char* kScriptChars =
|
| "class Test {"
|
| @@ -8035,7 +7799,6 @@ TEST_CASE(NativeStaticFunctionClosure) {
|
| EXPECT_EQ(0, value);
|
| }
|
|
|
| -
|
| TEST_CASE(RangeLimits) {
|
| uint8_t chars8[1] = {'a'};
|
| uint16_t chars16[1] = {'a'};
|
| @@ -8061,7 +7824,6 @@ TEST_CASE(RangeLimits) {
|
| "expects argument 'length' to be in the range");
|
| }
|
|
|
| -
|
| TEST_CASE(NewString_Null) {
|
| Dart_Handle str = Dart_NewStringFromUTF8(NULL, 0);
|
| EXPECT_VALID(str);
|
| @@ -8085,7 +7847,6 @@ TEST_CASE(NewString_Null) {
|
| EXPECT_EQ(0, len);
|
| }
|
|
|
| -
|
| // Try to allocate a peer with a handles to objects of prohibited
|
| // subtypes.
|
| TEST_CASE(InvalidGetSetPeer) {
|
| @@ -8117,7 +7878,6 @@ TEST_CASE(InvalidGetSetPeer) {
|
| EXPECT(Dart_IsError(Dart_SetPeer(dbl, &out)));
|
| }
|
|
|
| -
|
| // Allocates an object in new space and assigns it a peer. Removes
|
| // the peer and checks that the count of peer objects is decremented
|
| // by one.
|
| @@ -8143,7 +7903,6 @@ TEST_CASE(OneNewSpacePeer) {
|
| EXPECT_EQ(0, isolate->heap()->PeerCount());
|
| }
|
|
|
| -
|
| // Allocates an object in new space and assigns it a peer. Allows the
|
| // peer referent to be garbage collected and checks that the count of
|
| // peer objects is decremented by one.
|
| @@ -8183,7 +7942,6 @@ TEST_CASE(CollectOneNewSpacePeer) {
|
| }
|
| }
|
|
|
| -
|
| // Allocates two objects in new space and assigns them peers. Removes
|
| // the peers and checks that the count of peer objects is decremented
|
| // by two.
|
| @@ -8223,7 +7981,6 @@ TEST_CASE(TwoNewSpacePeers) {
|
| EXPECT(o2 == NULL);
|
| }
|
|
|
| -
|
| // Allocates two objects in new space and assigns them a peer. Allow
|
| // the peer referents to be garbage collected and check that the count
|
| // of peer objects is decremented by two.
|
| @@ -8266,7 +8023,6 @@ TEST_CASE(CollectTwoNewSpacePeers) {
|
| }
|
| }
|
|
|
| -
|
| // Allocates several objects in new space. Performs successive
|
| // garbage collections and checks that the peer count is stable.
|
| TEST_CASE(CopyNewSpacePeers) {
|
| @@ -8300,7 +8056,6 @@ TEST_CASE(CopyNewSpacePeers) {
|
| }
|
| }
|
|
|
| -
|
| // Allocates an object in new space and assigns it a peer. Promotes
|
| // the peer to old space. Removes the peer and check that the count
|
| // of peer objects is decremented by one.
|
| @@ -8341,7 +8096,6 @@ TEST_CASE(OnePromotedPeer) {
|
| EXPECT_EQ(0, isolate->heap()->PeerCount());
|
| }
|
|
|
| -
|
| // Allocates an object in old space and assigns it a peer. Removes
|
| // the peer and checks that the count of peer objects is decremented
|
| // by one.
|
| @@ -8374,7 +8128,6 @@ TEST_CASE(OneOldSpacePeer) {
|
| EXPECT_EQ(0, isolate->heap()->PeerCount());
|
| }
|
|
|
| -
|
| // Allocates an object in old space and assigns it a peer. Allow the
|
| // peer referent to be garbage collected and check that the count of
|
| // peer objects is decremented by one.
|
| @@ -8414,7 +8167,6 @@ TEST_CASE(CollectOneOldSpacePeer) {
|
| }
|
| }
|
|
|
| -
|
| // Allocates two objects in old space and assigns them peers. Removes
|
| // the peers and checks that the count of peer objects is decremented
|
| // by two.
|
| @@ -8458,7 +8210,6 @@ TEST_CASE(TwoOldSpacePeers) {
|
| EXPECT(o2 == NULL);
|
| }
|
|
|
| -
|
| // Allocates two objects in old space and assigns them a peer. Allows
|
| // the peer referents to be garbage collected and checks that the
|
| // count of peer objects is decremented by two.
|
| @@ -8504,13 +8255,11 @@ TEST_CASE(CollectTwoOldSpacePeers) {
|
| }
|
| }
|
|
|
| -
|
| // Test API call to make strings external.
|
| static void MakeExternalCback(void* peer) {
|
| *static_cast<int*>(peer) *= 2;
|
| }
|
|
|
| -
|
| TEST_CASE(MakeExternalString) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -8696,7 +8445,6 @@ TEST_CASE(MakeExternalString) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalizeConstantStrings) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -8722,7 +8470,6 @@ TEST_CASE(ExternalizeConstantStrings) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(LazyLoadDeoptimizes) {
|
| const char* kLoadFirst =
|
| "library L;\n"
|
| @@ -8765,13 +8512,11 @@ TEST_CASE(LazyLoadDeoptimizes) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| // Test external strings and optimized code.
|
| static void ExternalStringDeoptimize_Finalize(void* peer) {
|
| delete[] reinterpret_cast<char*>(peer);
|
| }
|
|
|
| -
|
| static void A_change_str_native(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| Dart_Handle str = Dart_GetNativeArgument(args, 0);
|
| @@ -8793,7 +8538,6 @@ static void A_change_str_native(Dart_NativeArguments args) {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| static Dart_NativeFunction ExternalStringDeoptimize_native_lookup(
|
| Dart_Handle name,
|
| int argument_count,
|
| @@ -8803,7 +8547,6 @@ static Dart_NativeFunction ExternalStringDeoptimize_native_lookup(
|
| return reinterpret_cast<Dart_NativeFunction>(&A_change_str_native);
|
| }
|
|
|
| -
|
| // Do not use guarding mechanism on externalizable classes, since their class
|
| // can change on the fly,
|
| TEST_CASE(GuardExternalizedString) {
|
| @@ -8845,7 +8588,6 @@ TEST_CASE(GuardExternalizedString) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringDeoptimize) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -8881,7 +8623,6 @@ TEST_CASE(ExternalStringDeoptimize) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringPolymorphicDeoptimize) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -8918,7 +8659,6 @@ TEST_CASE(ExternalStringPolymorphicDeoptimize) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringLoadElimination) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -8949,7 +8689,6 @@ TEST_CASE(ExternalStringLoadElimination) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringGuardFieldDeoptimize) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -8991,7 +8730,6 @@ TEST_CASE(ExternalStringGuardFieldDeoptimize) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringStaticFieldDeoptimize) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -9028,7 +8766,6 @@ TEST_CASE(ExternalStringStaticFieldDeoptimize) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringTrimDoubleParse) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -9058,7 +8795,6 @@ TEST_CASE(ExternalStringTrimDoubleParse) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringDoubleParse) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
| @@ -9088,7 +8824,6 @@ TEST_CASE(ExternalStringDoubleParse) {
|
| FLAG_support_externalizable_strings = saved_flag;
|
| }
|
|
|
| -
|
| TEST_CASE(ExternalStringIndexOf) {
|
| const char* kScriptChars =
|
| "main(String pattern) {\n"
|
| @@ -9113,7 +8848,6 @@ TEST_CASE(ExternalStringIndexOf) {
|
| EXPECT_EQ(6, value);
|
| }
|
|
|
| -
|
| TEST_CASE(StringFromExternalTypedData) {
|
| const char* kScriptChars =
|
| "test(external) {\n"
|
| @@ -9191,10 +8925,8 @@ TEST_CASE(StringFromExternalTypedData) {
|
| }
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineDuration) {
|
| Isolate* isolate = Isolate::Current();
|
| // Grab embedder stream.
|
| @@ -9213,7 +8945,6 @@ TEST_CASE(Timeline_Dart_TimelineDuration) {
|
| EXPECT_SUBSTRING("testDurationEvent", js.ToCString());
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineInstant) {
|
| Isolate* isolate = Isolate::Current();
|
| // Grab embedder stream.
|
| @@ -9231,7 +8962,6 @@ TEST_CASE(Timeline_Dart_TimelineInstant) {
|
| EXPECT_SUBSTRING("testInstantEvent", js.ToCString());
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) {
|
| // Grab embedder stream.
|
| TimelineStream* stream = Timeline::GetEmbedderStream();
|
| @@ -9249,7 +8979,6 @@ TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) {
|
| EXPECT_NOTSUBSTRING("testAsyncEvent", js.ToCString());
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineAsync) {
|
| Isolate* isolate = Isolate::Current();
|
| // Grab embedder stream.
|
| @@ -9269,13 +8998,11 @@ TEST_CASE(Timeline_Dart_TimelineAsync) {
|
| EXPECT_SUBSTRING("testAsyncEvent", js.ToCString());
|
| }
|
|
|
| -
|
| struct AppendData {
|
| uint8_t* buffer;
|
| intptr_t buffer_length;
|
| };
|
|
|
| -
|
| static void AppendStreamConsumer(Dart_StreamConsumer_State state,
|
| const char* stream_name,
|
| const uint8_t* buffer,
|
| @@ -9302,7 +9029,6 @@ static void AppendStreamConsumer(Dart_StreamConsumer_State state,
|
| data->buffer_length += buffer_length;
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineGetTrace) {
|
| const char* kScriptChars =
|
| "foo() => 'a';\n"
|
| @@ -9346,7 +9072,6 @@ TEST_CASE(Timeline_Dart_TimelineGetTrace) {
|
| free(data.buffer);
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineGetTraceOnlyDartEvents) {
|
| const char* kScriptChars =
|
| "import 'dart:developer';\n"
|
| @@ -9394,7 +9119,6 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceOnlyDartEvents) {
|
| free(data.buffer);
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_TimelineGetTraceWithDartEvents) {
|
| const char* kScriptChars =
|
| "import 'dart:developer';\n"
|
| @@ -9487,13 +9211,10 @@ TEST_CASE(Timeline_Dart_TimelineGetTraceGlobalOverride) {
|
| free(data.buffer);
|
| }
|
|
|
| -
|
| static const char* arg_names[] = {"arg0"};
|
|
|
| -
|
| static const char* arg_values[] = {"value0"};
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_GlobalTimelineGetTrace) {
|
| const char* kScriptChars =
|
| "bar() => 'z';\n"
|
| @@ -9611,7 +9332,6 @@ TEST_CASE(Timeline_Dart_GlobalTimelineGetTrace) {
|
| free(data.buffer);
|
| }
|
|
|
| -
|
| class GlobalTimelineThreadData {
|
| public:
|
| GlobalTimelineThreadData()
|
| @@ -9641,7 +9361,6 @@ class GlobalTimelineThreadData {
|
| bool running_;
|
| };
|
|
|
| -
|
| static void GlobalTimelineThread(uword parameter) {
|
| GlobalTimelineThreadData* data =
|
| reinterpret_cast<GlobalTimelineThreadData*>(parameter);
|
| @@ -9658,7 +9377,6 @@ static void GlobalTimelineThread(uword parameter) {
|
| }
|
| }
|
|
|
| -
|
| // This test is the same as the one above except that the calls to
|
| // Dart_GlobalTimelineGetTrace are made from a fresh thread. This ensures that
|
| // we can call the function from a thread for which we have not set up a
|
| @@ -9771,7 +9489,6 @@ static void StopRecording() {
|
| stop_called = true;
|
| }
|
|
|
| -
|
| TEST_CASE(Timeline_Dart_EmbedderTimelineStartStopRecording) {
|
| Dart_SetEmbedderTimelineCallbacks(StartRecording, StopRecording);
|
|
|
| @@ -9790,7 +9507,6 @@ TEST_CASE(Timeline_Dart_EmbedderTimelineStartStopRecording) {
|
| EXPECT(stop_called);
|
| }
|
|
|
| -
|
| TEST_CASE(Dart_LoadLibraryPatch_1) {
|
| const char* kScriptChars1 =
|
| "class A {\n"
|
| @@ -9823,7 +9539,6 @@ TEST_CASE(Dart_LoadLibraryPatch_1) {
|
| EXPECT_VALID(result);
|
| }
|
|
|
| -
|
| TEST_CASE(Dart_LoadLibraryPatch_Error1) {
|
| const char* kScriptChars1 =
|
| "class A {\n"
|
| @@ -9854,7 +9569,6 @@ TEST_CASE(Dart_LoadLibraryPatch_Error1) {
|
| EXPECT(Dart_IsError(result));
|
| }
|
|
|
| -
|
| TEST_CASE(Dart_LoadLibraryPatch_Error2) {
|
| const char* kScriptChars1 =
|
| "class A {\n"
|
| @@ -9885,7 +9599,6 @@ TEST_CASE(Dart_LoadLibraryPatch_Error2) {
|
| OS::Print("Patched class executed\n");
|
| }
|
|
|
| -
|
| TEST_CASE(Dart_LoadLibraryPatch_Error3) {
|
| const char* kScriptChars1 =
|
| "class A {\n"
|
|
|