Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::testing::DartWeakPersistentHandle Class Reference
Inheritance diagram for flutter::testing::DartWeakPersistentHandle:
flutter::testing::FixtureTest flutter::testing::DartFixture flutter::testing::ThreadTest

Public Member Functions

 DartWeakPersistentHandle ()
 
 ~DartWeakPersistentHandle ()=default
 
bool RunWithEntrypoint (const std::string &entrypoint)
 
bool RunInIsolateScope (std::function< bool(void)> closure)
 
- Public Member Functions inherited from flutter::testing::FixtureTest
 FixtureTest ()
 
 FixtureTest (std::string kernel_filename, std::string elf_filename, std::string elf_split_filename)
 
- Public Member Functions inherited from flutter::testing::DartFixture
 DartFixture ()
 
 DartFixture (std::string kernel_filename, std::string elf_filename, std::string elf_split_filename)
 
virtual Settings CreateSettingsForFixture ()
 
void AddNativeCallback (const std::string &name, Dart_NativeFunction callback)
 
void AddFfiNativeCallback (const std::string &name, void *callback_ptr)
 
- Public Member Functions inherited from flutter::testing::ThreadTest
 ThreadTest ()
 
fml::RefPtr< fml::TaskRunnerGetCurrentTaskRunner ()
 Get the task runner for the thread that the current unit-test is running on. This creates a message loop as necessary.
 
fml::RefPtr< fml::TaskRunnerCreateNewThread (const std::string &name="")
 Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test. The message loop is terminated (and its thread joined) when the test ends. This allows tests to create multiple named threads as necessary.
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::testing::DartFixture
void SetSnapshotsAndAssets (Settings &settings)
 
- Protected Attributes inherited from flutter::testing::DartFixture
std::shared_ptr< TestDartNativeResolvernative_resolver_
 
ELFAOTSymbols split_aot_symbols_
 
std::string kernel_filename_
 
std::string elf_filename_
 
fml::UniqueFD assets_dir_
 
ELFAOTSymbols aot_symbols_
 

Detailed Description

Definition at line 15 of file dart_weak_persistent_handle_unittest.cc.

Constructor & Destructor Documentation

◆ DartWeakPersistentHandle()

flutter::testing::DartWeakPersistentHandle::DartWeakPersistentHandle ( )
inline

Definition at line 17 of file dart_weak_persistent_handle_unittest.cc.

18 : settings_(CreateSettingsForFixture()),
19 vm_(DartVMRef::Create(settings_)) {}
static DartVMRef Create(const Settings &settings, fml::RefPtr< const DartSnapshot > vm_snapshot=nullptr, fml::RefPtr< const DartSnapshot > isolate_snapshot=nullptr)
virtual Settings CreateSettingsForFixture()

◆ ~DartWeakPersistentHandle()

flutter::testing::DartWeakPersistentHandle::~DartWeakPersistentHandle ( )
default

Member Function Documentation

◆ RunInIsolateScope()

bool flutter::testing::DartWeakPersistentHandle::RunInIsolateScope ( std::function< bool(void)>  closure)
inline

Definition at line 41 of file dart_weak_persistent_handle_unittest.cc.

41 {
42 return running_isolate_->RunInIsolateScope(closure);
43 }

◆ RunWithEntrypoint()

bool flutter::testing::DartWeakPersistentHandle::RunWithEntrypoint ( const std::string &  entrypoint)
inline

Definition at line 23 of file dart_weak_persistent_handle_unittest.cc.

23 {
24 if (running_isolate_) {
25 return false;
26 }
27 auto thread = CreateNewThread();
28 TaskRunners single_threaded_task_runner(GetCurrentTestName(), thread,
29 thread, thread, thread);
30 auto isolate =
31 RunDartCodeInIsolate(vm_, settings_, single_threaded_task_runner,
32 entrypoint, {}, GetDefaultKernelFilePath());
33 if (!isolate || isolate->get()->GetPhase() != DartIsolate::Phase::Running) {
34 return false;
35 }
36
37 running_isolate_ = std::move(isolate);
38 return true;
39 }
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...
std::string GetCurrentTestName()
Gets the name of the currently running test. This is useful in generating logs or assets based on tes...
Definition testing.cc:15
std::string GetDefaultKernelFilePath()
Returns the default path to kernel_blob.bin. This file is within the directory returned by GetFixture...
Definition testing.cc:19
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)

The documentation for this class was generated from the following file: