5#include "flutter/shell/common/shell_io_manager.h"
7#include "flutter/common/task_runners.h"
8#include "flutter/fml/mapping.h"
9#include "flutter/lib/ui/painting/multi_frame_codec.h"
10#include "flutter/testing/dart_isolate_runner.h"
11#include "flutter/testing/fixture_test.h"
12#include "flutter/testing/post_task_sync.h"
13#include "flutter/testing/test_gl_surface.h"
14#include "flutter/testing/testing.h"
23 ItDoesNotCrashThatSkiaUnrefQueueDrainAfterIOManagerReset) {
24 auto settings = CreateSettingsForFixture();
26 auto vm_data = vm_ref.GetVMData();
28 ASSERT_TRUE(gif_mapping);
31 std::shared_ptr<ImageGenerator> gif_generator =
33 ASSERT_TRUE(gif_generator);
42 std::unique_ptr<TestGLSurface> gl_surface;
43 std::unique_ptr<ShellIOManager> io_manager;
48 gl_surface = std::make_unique<TestGLSurface>(SkISize::Make(1, 1));
49 io_manager = std::make_unique<ShellIOManager>(
50 gl_surface->CreateGrContext(), std::make_shared<fml::SyncSwitch>(),
51 runners.GetIOTaskRunner(), nullptr,
52 fml::TimeDelta::FromMilliseconds(0));
57 io_manager->GetWeakIOManager());
60 fml::AutoResetWaitableEvent isolate_latch;
62 EXPECT_TRUE(isolate->RunInIsolateScope([&]() -> bool {
63 Dart_Handle library = Dart_RootLibrary();
64 if (Dart_IsError(library)) {
65 isolate_latch.Signal();
69 Dart_GetField(library, Dart_NewStringFromCString(
"frameCallback"));
70 if (Dart_IsError(closure) || !Dart_IsClosure(closure)) {
71 isolate_latch.Signal();
75 codec = fml::MakeRefCounted<MultiFrameCodec>(std::move(gif_generator));
76 codec->getNextFrame(closure);
77 isolate_latch.Signal();
static DartVMRef Create(const Settings &settings, fml::RefPtr< const DartSnapshot > vm_snapshot=nullptr, fml::RefPtr< const DartSnapshot > isolate_snapshot=nullptr)
Keeps a priority-ordered registry of image generator builders to be used when decoding images....
std::shared_ptr< ImageGenerator > CreateCompatibleGenerator(const sk_sp< SkData > &buffer)
Walks the list of image generator builders in descending priority order until a compatible ImageGener...
fml::RefPtr< fml::TaskRunner > GetUITaskRunner() const
fml::RefPtr< fml::TaskRunner > GetIOTaskRunner() const
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)
void PostTaskSync(const fml::RefPtr< fml::TaskRunner > &task_runner, const std::function< void()> &function)
std::string GetDefaultKernelFilePath()
Returns the default path to kernel_blob.bin. This file is within the directory returned by GetFixture...
sk_sp< SkData > OpenFixtureAsSkData(const std::string &fixture_name)
Opens a fixture of the given file name and returns a Skia SkData holding its contents.
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)