5#include "flutter/runtime/dart_isolate.h"
8#include "flutter/fml/paths.h"
9#include "flutter/runtime/dart_plugin_registrant.h"
10#include "flutter/runtime/dart_vm.h"
11#include "flutter/runtime/dart_vm_lifecycle.h"
12#include "flutter/testing/dart_isolate_runner.h"
13#include "flutter/testing/fixture_test.h"
14#include "flutter/testing/testing.h"
23const std::string
kElfFileName =
"plugin_registrant_app_elf_snapshot.so";
37 if (source_path[0] !=
'/') {
39 source_path =
"/" + source_path;
41 std::string registrant_uri = std::string(
"file://") + source_path +
42 "flutter/runtime/fixtures/dart_tool/"
43 "flutter_build/dart_plugin_registrant.dart";
57 std::vector<std::string> messages;
69 auto settings = CreateSettingsForFixture();
70 auto did_throw_exception =
false;
71 settings.unhandled_exception_callback = [&](
const std::string&
error,
72 const std::string& stack_trace) {
73 did_throw_exception =
true;
90 "mainForPluginRegistrantTest", {}, kernel_path);
97 ASSERT_EQ(messages.size(), 1u);
98 ASSERT_EQ(messages[0],
"_PluginRegistrant.register() was called");
104 std::vector<std::string> messages;
116 auto settings = CreateSettingsForFixture();
117 auto did_throw_exception =
false;
118 settings.unhandled_exception_callback = [&](
const std::string&
error,
119 const std::string& stack_trace) {
120 did_throw_exception =
true;
137 "callDartPluginRegistrantFromBackgroundIsolate", {}, kernel_path);
139 ASSERT_TRUE(isolate);
144 ASSERT_EQ(messages.size(), 1u);
145 ASSERT_EQ(messages[0],
146 "_PluginRegistrant.register() was called on background isolate");
152 std::vector<std::string> messages;
164 auto settings = CreateSettingsForFixture();
165 auto did_throw_exception =
false;
166 settings.unhandled_exception_callback = [&](
const std::string&
error,
167 const std::string& stack_trace) {
168 did_throw_exception =
true;
185 "dontCallDartPluginRegistrantFromBackgroundIsolate", {}, kernel_path);
187 ASSERT_TRUE(isolate);
192 ASSERT_EQ(messages.size(), 1u);
195 "_PluginRegistrant.register() was not called on background isolate");
201 std::vector<std::string> messages;
213 auto settings = CreateSettingsForFixture();
214 auto did_throw_exception =
false;
215 settings.unhandled_exception_callback = [&](
const std::string&
error,
216 const std::string& stack_trace) {
217 did_throw_exception =
true;
234 "registerBackgroundIsolateCallsDartPluginRegistrant", {}, kernel_path);
236 ASSERT_TRUE(isolate);
241 ASSERT_EQ(messages.size(), 1u);
242 ASSERT_EQ(messages[0],
243 "_PluginRegistrant.register() was called on background isolate");
static DartVMRef Create(const Settings &settings, fml::RefPtr< const DartSnapshot > vm_snapshot=nullptr, fml::RefPtr< const DartSnapshot > isolate_snapshot=nullptr)
static bool IsInstanceRunning()
std::string dart_plugin_registrant_library_
void OverrideDartPluginRegistrant(const std::string &override_value)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
struct _Dart_NativeArguments * Dart_NativeArguments
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name)
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)
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
const char * GetSourcePath()
const std::string kElfFileName
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)
const std::string kKernelFileName
const char * dart_plugin_registrant_library_override
std::string JoinPaths(std::initializer_list< std::string > components)
#define CREATE_NATIVE_ENTRY(native_entry)