5#include "flutter/testing/dart_isolate_runner.h"
6#include "flutter/testing/fixture_test.h"
12void NopFinalizer(
void* isolate_callback_data,
void* peer) {}
24 if (running_isolate_) {
29 thread, thread, thread);
37 running_isolate_ = std::move(isolate);
42 return running_isolate_->RunInIsolateScope(
closure);
48 std::unique_ptr<AutoIsolateShutdown> running_isolate_;
62 ASSERT_TRUE(dart_state);
64 weak_persistent_value.Set(dart_state, handle,
nullptr, 0, NopFinalizer);
66 weak_persistent_value.Clear();
71 ASSERT_TRUE(RunWithEntrypoint(
"callGiveObjectToNative"));
86 ASSERT_TRUE(dart_state);
88 weak_persistent_value.Set(dart_state, handle,
nullptr, 0, NopFinalizer);
95 ASSERT_TRUE(RunWithEntrypoint(
"callGiveObjectToNative"));
99 ASSERT_TRUE(RunInIsolateScope([&weak_persistent_value]() ->
bool {
101 weak_persistent_value.Clear();
116 ASSERT_TRUE(dart_state);
118 weak_persistent_value.Set(dart_state, handle,
nullptr, 0, NopFinalizer);
123 AddNativeCallback(
"SignalDone",
126 weak_persistent_value.Clear();
131 ASSERT_TRUE(RunWithEntrypoint(
"testClearLater"));
143 AddNativeCallback(
"GiveObjectToNative",
148 ASSERT_TRUE(dart_state);
156 dart_state, handle,
nullptr, 0, NopFinalizer);
163 ASSERT_TRUE(RunWithEntrypoint(
"callGiveObjectToNative"));
static sk_sp< Effect > Create()
virtual Settings CreateSettingsForFixture()
DartWeakPersistentHandle()
bool RunInIsolateScope(std::function< bool(void)> closure)
bool RunWithEntrypoint(const std::string &entrypoint)
~DartWeakPersistentHandle()=default
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name="")
Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test...
static DartState * Current()
void Set(DartState *dart_state, Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
struct _Dart_NativeArguments * Dart_NativeArguments
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Dart_NativeFunction function
std::string GetCurrentTestName()
Gets the name of the currently running test. This is useful in generating logs or assets based on tes...
TEST_F(DisplayListTest, Defaults)
std::string GetDefaultKernelFilePath()
Returns the default path to kernel_blob.bin. This file is within the directory returned by GetFixture...
std::unique_ptr< AutoIsolateShutdown > RunDartCodeInIsolate(DartVMRef &vm_ref, const Settings &settings, const TaskRunners &task_runners, std::string entrypoint, const std::vector< std::string > &args, const std::string &kernel_file_path, fml::WeakPtr< IOManager > io_manager, std::shared_ptr< VolatilePathTracker > volatile_path_tracker, std::unique_ptr< PlatformConfiguration > platform_configuration)
tonic::DartWeakPersistentValue global_weak_persistent_value
std::function< void()> closure
#define CREATE_NATIVE_ENTRY(native_entry)