Flutter Engine
The Flutter Engine
Namespaces | Macros | Functions
snapshot_test.cc File Reference
#include "platform/globals.h"
#include "include/dart_tools_api.h"
#include "platform/assert.h"
#include "platform/unicode.h"
#include "vm/app_snapshot.h"
#include "vm/class_finalizer.h"
#include "vm/dart_api_impl.h"
#include "vm/dart_api_message.h"
#include "vm/dart_api_state.h"
#include "vm/debugger_api_impl_test.h"
#include "vm/flags.h"
#include "vm/message_snapshot.h"
#include "vm/snapshot.h"
#include "vm/symbols.h"
#include "vm/timer.h"
#include "vm/unit_test.h"

Go to the source code of this file.

Namespaces

namespace  dart
 

Macros

#define TEST_ROUND_TRIP_IDENTICAL(object)
 
#define TEST_TYPED_ARRAY(darttype, ctype)
 
#define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype)
 
#define TEST_UNMODIFIABLE_EXTERNAL_TYPED_ARRAY(darttype, ctype)
 

Functions

static bool dart::Equals (const Object &expected, const Object &actual)
 
static void dart::CompareDartCObjects (Dart_CObject *first, Dart_CObject *second)
 
static void dart::CheckEncodeDecodeMessage (Zone *zone, Dart_CObject *root)
 
static void dart::ExpectEncodeFail (Zone *zone, Dart_CObject *root)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeNull)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeSmi1)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeSmi2)
 
Dart_CObjectdart::SerializeAndDeserializeMint (Zone *zone, const Mint &mint)
 
void dart::CheckMint (int64_t value)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeMints)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeDouble)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeTrue)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeFalse)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeCapability)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeSingletons)
 
static void dart::TestString (const char *cstr)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeString)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeArray)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeArrayWithTypeArgument)
 
 dart::TEST_CASE (FailSerializeLargeArray)
 
 dart::TEST_CASE (FailSerializeLargeNestedArray)
 
 dart::TEST_CASE (FailSerializeLargeTypedDataInt8)
 
 dart::TEST_CASE (FailSerializeLargeTypedDataUint8)
 
 dart::TEST_CASE (FailSerializeLargeExternalTypedData)
 
 dart::TEST_CASE (FailSerializeLargeUnmodifiableExternalTypedData)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeEmptyArray)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeByteArray)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeTypedArray)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeExternalTypedArray)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeUnmodifiableExternalTypedArray)
 
 dart::ISOLATE_UNIT_TEST_CASE (SerializeEmptyByteArray)
 
 dart::VM_UNIT_TEST_CASE (FullSnapshot)
 
static std::unique_ptr< Messagedart::GetSerialized (Dart_Handle lib, const char *dart_function)
 
static void dart::CheckString (Dart_Handle dart_string, const char *expected)
 
static void dart::CheckStringInvalid (Dart_Handle dart_string)
 
 dart::VM_UNIT_TEST_CASE (DartGeneratedMessages)
 
 dart::VM_UNIT_TEST_CASE (DartGeneratedListMessages)
 
 dart::VM_UNIT_TEST_CASE (DartGeneratedArrayLiteralMessages)
 
 dart::VM_UNIT_TEST_CASE (DartGeneratedListMessagesWithBackref)
 
 dart::VM_UNIT_TEST_CASE (DartGeneratedArrayLiteralMessagesWithBackref)
 
static void dart::CheckTypedData (Dart_CObject *object, Dart_TypedData_Type typed_data_type, int len)
 
 dart::VM_UNIT_TEST_CASE (DartGeneratedListMessagesWithTypedData)
 
static void dart::MallocFinalizer (void *isolate_callback_data, void *peer)
 
static void dart::NoopFinalizer (void *isolate_callback_data, void *peer)
 
 dart::VM_UNIT_TEST_CASE (PostCObject)
 
 dart::TEST_CASE (IsKernelNegative)
 

Macro Definition Documentation

◆ TEST_EXTERNAL_TYPED_ARRAY

#define TEST_EXTERNAL_TYPED_ARRAY (   darttype,
  ctype 
)
Value:
{ \
StackZone zone(thread); \
ctype data[] = {0, 11, 22, 33, 44, 55, 66, 77}; \
intptr_t length = ARRAY_SIZE(data); \
ExternalTypedData& array = ExternalTypedData::Handle( \
ExternalTypedData::New(kExternalTypedData##darttype##ArrayCid, \
reinterpret_cast<uint8_t*>(data), length)); \
intptr_t scale = array.ElementSizeInBytes(); \
std::unique_ptr<Message> message = \
WriteMessage(/* same_group */ false, array, ILLEGAL_PORT, \
Message::kNormalPriority); \
ExternalTypedData& serialized_array = ExternalTypedData::Handle(); \
serialized_array ^= ReadMessage(thread, message.get()); \
for (int i = 0; i < length; i++) { \
EXPECT_EQ(static_cast<ctype>(data[i]), \
serialized_array.Get##darttype(i* scale)); \
} \
}
#define ILLEGAL_PORT
Definition: dart_api.h:1535
size_t length
Win32Message message
ObjectPtr ReadMessage(Thread *thread, Message *message)
const Scalar scale
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
#define ARRAY_SIZE(array)
Definition: globals.h:72

Definition at line 605 of file snapshot_test.cc.

◆ TEST_ROUND_TRIP_IDENTICAL

#define TEST_ROUND_TRIP_IDENTICAL (   object)
Value:
{ \
const Object& before = Object::Handle(object); \
std::unique_ptr<Message> message = \
WriteMessage(/* same_group */ false, before, ILLEGAL_PORT, \
Message::kNormalPriority); \
const Object& after = Object::Handle(ReadMessage(thread, message.get())); \
EXPECT(before.ptr() == after.ptr()); \
}

Definition at line 349 of file snapshot_test.cc.

◆ TEST_TYPED_ARRAY

#define TEST_TYPED_ARRAY (   darttype,
  ctype 
)
Value:
{ \
StackZone zone(thread); \
const int kArrayLength = 127; \
TypedData& array = TypedData::Handle( \
TypedData::New(kTypedData##darttype##ArrayCid, kArrayLength)); \
intptr_t scale = array.ElementSizeInBytes(); \
for (int i = 0; i < kArrayLength; i++) { \
array.Set##darttype((i * scale), i); \
} \
std::unique_ptr<Message> message = \
WriteMessage(/* same_group */ false, array, ILLEGAL_PORT, \
Message::kNormalPriority); \
TypedData& serialized_array = TypedData::Handle(); \
serialized_array ^= ReadMessage(thread, message.get()); \
for (int i = 0; i < kArrayLength; i++) { \
EXPECT_EQ(static_cast<ctype>(i), \
serialized_array.Get##darttype(i* scale)); \
} \
}

Definition at line 584 of file snapshot_test.cc.

◆ TEST_UNMODIFIABLE_EXTERNAL_TYPED_ARRAY

#define TEST_UNMODIFIABLE_EXTERNAL_TYPED_ARRAY (   darttype,
  ctype 
)
Value:
{ \
StackZone zone(thread); \
ctype data[] = {0, 11, 22, 33, 44, 55, 66, 77}; \
intptr_t length = ARRAY_SIZE(data); \
ExternalTypedData& array = ExternalTypedData::Handle( \
ExternalTypedData::New(kExternalTypedData##darttype##ArrayCid, \
reinterpret_cast<uint8_t*>(data), length)); \
TypedDataView& view = TypedDataView::Handle(TypedDataView::New( \
kUnmodifiableTypedData##darttype##ArrayViewCid, array, 0, length)); \
intptr_t scale = array.ElementSizeInBytes(); \
std::unique_ptr<Message> message = WriteMessage( \
/* same_group */ false, view, ILLEGAL_PORT, Message::kNormalPriority); \
TypedDataView& serialized_view = TypedDataView::Handle(); \
serialized_view ^= ReadMessage(thread, message.get()); \
for (int i = 0; i < length; i++) { \
EXPECT_EQ(static_cast<ctype>(data[i]), \
serialized_view.Get##darttype(i* scale)); \
} \
}
std::unique_ptr< Message > WriteMessage(bool same_group, const Object &obj, Dart_Port dest_port, Message::Priority priority)

Definition at line 625 of file snapshot_test.cc.