Use ShellTest::Config struct to create Shell (flutter/engine#42332)
This commit is contained in:
@@ -54,7 +54,12 @@ static void TestSimulatedInputEvents(
|
||||
bool restart_engine = false) {
|
||||
///// Begin constructing shell ///////////////////////////////////////////////
|
||||
auto settings = fixture->CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell = fixture->CreateShell(settings, true);
|
||||
std::unique_ptr<Shell> shell = fixture->CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.simulate_vsync = true,
|
||||
}),
|
||||
});
|
||||
|
||||
auto configuration = RunConfiguration::InferFromSettings(settings);
|
||||
configuration.SetEntrypoint("onPointerDataPacketMain");
|
||||
@@ -300,7 +305,12 @@ TEST_F(ShellTest, HandlesActualIphoneXsInputEvents) {
|
||||
TEST_F(ShellTest, CanCorrectlyPipePointerPacket) {
|
||||
// Sets up shell with test fixture.
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell = CreateShell(settings, true);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.simulate_vsync = true,
|
||||
}),
|
||||
});
|
||||
|
||||
auto configuration = RunConfiguration::InferFromSettings(settings);
|
||||
configuration.SetEntrypoint("onPointerDataPacketMain");
|
||||
@@ -361,7 +371,12 @@ TEST_F(ShellTest, CanCorrectlyPipePointerPacket) {
|
||||
TEST_F(ShellTest, CanCorrectlySynthesizePointerPacket) {
|
||||
// Sets up shell with test fixture.
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell = CreateShell(settings, true);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.simulate_vsync = true,
|
||||
}),
|
||||
});
|
||||
|
||||
auto configuration = RunConfiguration::InferFromSettings(settings);
|
||||
configuration.SetEntrypoint("onPointerDataPacketMain");
|
||||
|
||||
@@ -320,49 +320,23 @@ fml::TimePoint ShellTest::GetLatestFrameTargetTime(Shell* shell) const {
|
||||
return shell->GetLatestFrameTargetTime();
|
||||
}
|
||||
|
||||
std::unique_ptr<Shell> ShellTest::CreateShell(const Settings& settings,
|
||||
bool simulate_vsync) {
|
||||
return CreateShell(settings, GetTaskRunnersForFixture(), simulate_vsync);
|
||||
}
|
||||
|
||||
std::unique_ptr<Shell> ShellTest::CreateShell(
|
||||
const Settings& settings,
|
||||
TaskRunners task_runners,
|
||||
bool simulate_vsync,
|
||||
const std::shared_ptr<ShellTestExternalViewEmbedder>&
|
||||
shell_test_external_view_embedder,
|
||||
bool is_gpu_disabled,
|
||||
ShellTestPlatformView::BackendType rendering_backend,
|
||||
Shell::CreateCallback<PlatformView> platform_view_create_callback) {
|
||||
const auto vsync_clock = std::make_shared<ShellTestVsyncClock>();
|
||||
|
||||
CreateVsyncWaiter create_vsync_waiter = [&]() {
|
||||
if (simulate_vsync) {
|
||||
return static_cast<std::unique_ptr<VsyncWaiter>>(
|
||||
std::make_unique<ShellTestVsyncWaiter>(task_runners, vsync_clock));
|
||||
} else {
|
||||
return static_cast<std::unique_ptr<VsyncWaiter>>(
|
||||
std::make_unique<VsyncWaiterFallback>(task_runners, true));
|
||||
}
|
||||
};
|
||||
std::optional<TaskRunners> task_runners) {
|
||||
return CreateShell({
|
||||
.settings = settings,
|
||||
.task_runners = std::move(task_runners),
|
||||
});
|
||||
}
|
||||
|
||||
std::unique_ptr<Shell> ShellTest::CreateShell(const Config& config) {
|
||||
TaskRunners task_runners = config.task_runners.has_value()
|
||||
? config.task_runners.value()
|
||||
: GetTaskRunnersForFixture();
|
||||
Shell::CreateCallback<PlatformView> platform_view_create_callback =
|
||||
config.platform_view_create_callback;
|
||||
if (!platform_view_create_callback) {
|
||||
platform_view_create_callback = [vsync_clock, //
|
||||
&create_vsync_waiter, //
|
||||
shell_test_external_view_embedder, //
|
||||
rendering_backend //
|
||||
](Shell& shell) {
|
||||
return ShellTestPlatformView::Create(
|
||||
shell, //
|
||||
shell.GetTaskRunners(), //
|
||||
vsync_clock, //
|
||||
create_vsync_waiter, //
|
||||
rendering_backend, //
|
||||
shell_test_external_view_embedder, //
|
||||
shell.GetConcurrentWorkerTaskRunner(), //
|
||||
shell.GetIsGpuDisabledSyncSwitch() //
|
||||
);
|
||||
};
|
||||
platform_view_create_callback = ShellTestPlatformViewBuilder({});
|
||||
}
|
||||
|
||||
Shell::CreateCallback<Rasterizer> rasterizer_create_callback =
|
||||
@@ -370,10 +344,10 @@ std::unique_ptr<Shell> ShellTest::CreateShell(
|
||||
|
||||
return Shell::Create(flutter::PlatformData(), //
|
||||
task_runners, //
|
||||
settings, //
|
||||
config.settings, //
|
||||
platform_view_create_callback, //
|
||||
rasterizer_create_callback, //
|
||||
is_gpu_disabled //
|
||||
config.is_gpu_disabled //
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,22 +31,24 @@ namespace testing {
|
||||
|
||||
class ShellTest : public FixtureTest {
|
||||
public:
|
||||
struct Config {
|
||||
// Required.
|
||||
const Settings& settings;
|
||||
// Defaults to GetTaskRunnersForFixture().
|
||||
std::optional<TaskRunners> task_runners = {};
|
||||
bool is_gpu_disabled = false;
|
||||
// Defaults to calling ShellTestPlatformView::Create with the provided
|
||||
// arguments.
|
||||
Shell::CreateCallback<PlatformView> platform_view_create_callback;
|
||||
};
|
||||
|
||||
ShellTest();
|
||||
|
||||
Settings CreateSettingsForFixture() override;
|
||||
std::unique_ptr<Shell> CreateShell(const Settings& settings,
|
||||
bool simulate_vsync = false);
|
||||
std::unique_ptr<Shell> CreateShell(
|
||||
const Settings& settings,
|
||||
TaskRunners task_runners,
|
||||
bool simulate_vsync = false,
|
||||
const std::shared_ptr<ShellTestExternalViewEmbedder>&
|
||||
shell_test_external_view_embedder = nullptr,
|
||||
bool is_gpu_disabled = false,
|
||||
ShellTestPlatformView::BackendType rendering_backend =
|
||||
ShellTestPlatformView::BackendType::kDefaultBackend,
|
||||
Shell::CreateCallback<PlatformView> platform_view_create_callback =
|
||||
nullptr);
|
||||
std::optional<TaskRunners> task_runners = {});
|
||||
std::unique_ptr<Shell> CreateShell(const Config& config);
|
||||
void DestroyShell(std::unique_ptr<Shell> shell);
|
||||
void DestroyShell(std::unique_ptr<Shell> shell,
|
||||
const TaskRunners& task_runners);
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "flutter/shell/common/shell_test_platform_view_metal.h"
|
||||
#endif // SHELL_ENABLE_METAL
|
||||
|
||||
#include "flutter/shell/common/vsync_waiter_fallback.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
@@ -57,5 +59,35 @@ std::unique_ptr<ShellTestPlatformView> ShellTestPlatformView::Create(
|
||||
}
|
||||
}
|
||||
|
||||
ShellTestPlatformViewBuilder::ShellTestPlatformViewBuilder(Config config)
|
||||
: config_(std::move(config)) {}
|
||||
|
||||
std::unique_ptr<PlatformView> ShellTestPlatformViewBuilder::operator()(
|
||||
Shell& shell) {
|
||||
const TaskRunners& task_runners = shell.GetTaskRunners();
|
||||
const auto vsync_clock = std::make_shared<ShellTestVsyncClock>();
|
||||
CreateVsyncWaiter create_vsync_waiter = [&task_runners, vsync_clock,
|
||||
simulate_vsync =
|
||||
config_.simulate_vsync]() {
|
||||
if (simulate_vsync) {
|
||||
return static_cast<std::unique_ptr<VsyncWaiter>>(
|
||||
std::make_unique<ShellTestVsyncWaiter>(task_runners, vsync_clock));
|
||||
} else {
|
||||
return static_cast<std::unique_ptr<VsyncWaiter>>(
|
||||
std::make_unique<VsyncWaiterFallback>(task_runners, true));
|
||||
}
|
||||
};
|
||||
return ShellTestPlatformView::Create(
|
||||
shell, //
|
||||
task_runners, //
|
||||
vsync_clock, //
|
||||
create_vsync_waiter, //
|
||||
config_.rendering_backend, //
|
||||
config_.shell_test_external_view_embedder, //
|
||||
shell.GetConcurrentWorkerTaskRunner(), //
|
||||
shell.GetIsGpuDisabledSyncSwitch() //
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace testing {
|
||||
class ShellTestPlatformView : public PlatformView {
|
||||
public:
|
||||
enum class BackendType {
|
||||
kDefaultBackend = 0,
|
||||
kGLBackend,
|
||||
kVulkanBackend,
|
||||
kMetalBackend,
|
||||
kDefaultBackend,
|
||||
};
|
||||
|
||||
static std::unique_ptr<ShellTestPlatformView> Create(
|
||||
@@ -43,6 +43,27 @@ class ShellTestPlatformView : public PlatformView {
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView);
|
||||
};
|
||||
|
||||
// Create a ShellTestPlatformView from configuration struct.
|
||||
class ShellTestPlatformViewBuilder {
|
||||
public:
|
||||
struct Config {
|
||||
bool simulate_vsync = false;
|
||||
std::shared_ptr<ShellTestExternalViewEmbedder>
|
||||
shell_test_external_view_embedder = nullptr;
|
||||
ShellTestPlatformView::BackendType rendering_backend =
|
||||
ShellTestPlatformView::BackendType::kDefaultBackend;
|
||||
};
|
||||
|
||||
ShellTestPlatformViewBuilder(Config config);
|
||||
~ShellTestPlatformViewBuilder() = default;
|
||||
|
||||
// Override operator () to make this class assignable to std::function.
|
||||
std::unique_ptr<PlatformView> operator()(Shell& shell);
|
||||
|
||||
private:
|
||||
Config config_;
|
||||
};
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
|
||||
@@ -430,9 +430,11 @@ TEST_F(ShellTest, InitializeWithDisabledGpu) {
|
||||
auto task_runner = thread_host.platform_thread->GetTaskRunner();
|
||||
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
|
||||
task_runner);
|
||||
auto shell = CreateShell(settings, task_runners, /*simulate_vsync=*/false,
|
||||
/*shell_test_external_view_embedder=*/nullptr,
|
||||
/*is_gpu_disabled=*/true);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.task_runners = task_runners,
|
||||
.is_gpu_disabled = true,
|
||||
});
|
||||
ASSERT_TRUE(DartVMRef::IsInstanceRunning());
|
||||
ASSERT_TRUE(ValidateShell(shell.get()));
|
||||
|
||||
@@ -807,8 +809,12 @@ TEST_F(ShellTest, ExternalEmbedderNoThreadMerger) {
|
||||
};
|
||||
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kResubmitFrame, false);
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -864,8 +870,12 @@ TEST_F(ShellTest, PushBackdropFilterToVisitedPlatformViews) {
|
||||
|
||||
external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kResubmitFrame, false);
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -933,8 +943,12 @@ TEST_F(ShellTest,
|
||||
};
|
||||
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kResubmitFrame, true);
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -974,8 +988,12 @@ TEST_F(ShellTest, OnPlatformViewDestroyDisablesThreadMerger) {
|
||||
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kSuccess, true);
|
||||
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1036,8 +1054,12 @@ TEST_F(ShellTest, OnPlatformViewDestroyAfterMergingThreads) {
|
||||
// Set resubmit once to trigger thread merging.
|
||||
external_view_embedder->UpdatePostPrerollResult(
|
||||
PostPrerollResult::kResubmitFrame);
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1100,8 +1122,12 @@ TEST_F(ShellTest, OnPlatformViewDestroyWhenThreadsAreMerging) {
|
||||
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kSuccess, true);
|
||||
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1163,8 +1189,12 @@ TEST_F(ShellTest,
|
||||
};
|
||||
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kSuccess, true);
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1202,8 +1232,7 @@ TEST_F(ShellTest,
|
||||
TEST_F(ShellTest, OnPlatformViewDestroyWithoutRasterThreadMerger) {
|
||||
auto settings = CreateSettingsForFixture();
|
||||
|
||||
auto shell =
|
||||
CreateShell(settings, GetTaskRunnersForFixture(), false, nullptr);
|
||||
auto shell = CreateShell(settings);
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1263,8 +1292,13 @@ TEST_F(ShellTest, OnPlatformViewDestroyWithStaticThreadMerging) {
|
||||
thread_host.ui_thread->GetTaskRunner(), // ui
|
||||
thread_host.io_thread->GetTaskRunner() // io
|
||||
);
|
||||
auto shell =
|
||||
CreateShell(settings, task_runners, false, external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.task_runners = task_runners,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1304,8 +1338,12 @@ TEST_F(ShellTest, GetUsedThisFrameShouldBeSetBeforeEndFrame) {
|
||||
};
|
||||
external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kSuccess, true);
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -1355,8 +1393,12 @@ TEST_F(ShellTest, DISABLED_SkipAndSubmitFrame) {
|
||||
external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
end_frame_callback, PostPrerollResult::kSkipAndRetryFrame, true);
|
||||
|
||||
auto shell = CreateShell(settings, GetTaskRunnersForFixture(), false,
|
||||
external_view_embedder);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
|
||||
@@ -1581,15 +1623,11 @@ TEST_F(ShellTest, MultipleFluttersSetResourceCacheBytes) {
|
||||
return result;
|
||||
};
|
||||
|
||||
auto shell = CreateShell(
|
||||
/*settings=*/settings,
|
||||
/*task_runners=*/task_runners,
|
||||
/*simulate_vsync=*/false,
|
||||
/*shell_test_external_view_embedder=*/nullptr,
|
||||
/*is_gpu_disabled=*/false,
|
||||
/*rendering_backend=*/
|
||||
ShellTestPlatformView::BackendType::kDefaultBackend,
|
||||
/*platform_view_create_callback=*/platform_view_create_callback);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.task_runners = task_runners,
|
||||
.platform_view_create_callback = platform_view_create_callback,
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -2631,8 +2669,12 @@ TEST_F(ShellTest, DISABLED_DiscardLayerTreeOnResize) {
|
||||
};
|
||||
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
std::move(end_frame_callback), PostPrerollResult::kSuccess, false);
|
||||
std::unique_ptr<Shell> shell = CreateShell(
|
||||
settings, GetTaskRunnersForFixture(), false, external_view_embedder);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -2704,8 +2746,12 @@ TEST_F(ShellTest, DISABLED_DiscardResubmittedLayerTreeOnResize) {
|
||||
external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
|
||||
std::move(end_frame_callback), PostPrerollResult::kResubmitFrame, true);
|
||||
|
||||
std::unique_ptr<Shell> shell = CreateShell(
|
||||
settings, GetTaskRunnersForFixture(), false, external_view_embedder);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.shell_test_external_view_embedder = external_view_embedder,
|
||||
}),
|
||||
});
|
||||
|
||||
// Create the surface needed by rasterizer
|
||||
PlatformViewNotifyCreated(shell.get());
|
||||
@@ -3558,14 +3604,12 @@ TEST_F(ShellTest, CanCreateShellsWithGLBackend) {
|
||||
GTEST_SKIP();
|
||||
#endif // !SHELL_ENABLE_GL
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, //
|
||||
GetTaskRunnersForFixture(), //
|
||||
false, //
|
||||
nullptr, //
|
||||
false, //
|
||||
ShellTestPlatformView::BackendType::kGLBackend //
|
||||
);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.rendering_backend = ShellTestPlatformView::BackendType::kGLBackend,
|
||||
}),
|
||||
});
|
||||
ASSERT_NE(shell, nullptr);
|
||||
ASSERT_TRUE(shell->IsSetup());
|
||||
auto configuration = RunConfiguration::InferFromSettings(settings);
|
||||
@@ -3582,14 +3626,13 @@ TEST_F(ShellTest, CanCreateShellsWithVulkanBackend) {
|
||||
GTEST_SKIP();
|
||||
#endif // !SHELL_ENABLE_VULKAN
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, //
|
||||
GetTaskRunnersForFixture(), //
|
||||
false, //
|
||||
nullptr, //
|
||||
false, //
|
||||
ShellTestPlatformView::BackendType::kVulkanBackend //
|
||||
);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.rendering_backend =
|
||||
ShellTestPlatformView::BackendType::kVulkanBackend,
|
||||
}),
|
||||
});
|
||||
ASSERT_NE(shell, nullptr);
|
||||
ASSERT_TRUE(shell->IsSetup());
|
||||
auto configuration = RunConfiguration::InferFromSettings(settings);
|
||||
@@ -3606,14 +3649,13 @@ TEST_F(ShellTest, CanCreateShellsWithMetalBackend) {
|
||||
GTEST_SKIP();
|
||||
#endif // !SHELL_ENABLE_METAL
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, //
|
||||
GetTaskRunnersForFixture(), //
|
||||
false, //
|
||||
nullptr, //
|
||||
false, //
|
||||
ShellTestPlatformView::BackendType::kMetalBackend //
|
||||
);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.rendering_backend =
|
||||
ShellTestPlatformView::BackendType::kMetalBackend,
|
||||
}),
|
||||
});
|
||||
ASSERT_NE(shell, nullptr);
|
||||
ASSERT_TRUE(shell->IsSetup());
|
||||
auto configuration = RunConfiguration::InferFromSettings(settings);
|
||||
@@ -3777,15 +3819,11 @@ TEST_F(ShellTest, UsesPlatformMessageHandler) {
|
||||
.WillOnce(Return(platform_message_handler));
|
||||
return result;
|
||||
};
|
||||
auto shell = CreateShell(
|
||||
/*settings=*/settings,
|
||||
/*task_runners=*/task_runners,
|
||||
/*simulate_vsync=*/false,
|
||||
/*shell_test_external_view_embedder=*/nullptr,
|
||||
/*is_gpu_disabled=*/false,
|
||||
/*rendering_backend=*/
|
||||
ShellTestPlatformView::BackendType::kDefaultBackend,
|
||||
/*platform_view_create_callback=*/platform_view_create_callback);
|
||||
auto shell = CreateShell({
|
||||
.settings = settings,
|
||||
.task_runners = task_runners,
|
||||
.platform_view_create_callback = platform_view_create_callback,
|
||||
});
|
||||
|
||||
EXPECT_EQ(platform_message_handler, shell->GetPlatformMessageHandler());
|
||||
PostSync(task_runners.GetUITaskRunner(), [&shell]() {
|
||||
@@ -3911,14 +3949,12 @@ TEST_F(ShellTest, PictureToImageSync) {
|
||||
GTEST_SKIP();
|
||||
#endif // !SHELL_ENABLE_GL
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, //
|
||||
GetTaskRunnersForFixture(), //
|
||||
false, //
|
||||
nullptr, //
|
||||
false, //
|
||||
ShellTestPlatformView::BackendType::kGLBackend //
|
||||
);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.rendering_backend = ShellTestPlatformView::BackendType::kGLBackend,
|
||||
}),
|
||||
});
|
||||
|
||||
AddNativeCallback("NativeOnBeforeToImageSync",
|
||||
CREATE_NATIVE_ENTRY([&](auto args) {
|
||||
@@ -3954,14 +3990,13 @@ TEST_F(ShellTest, PictureToImageSyncImpellerNoSurface) {
|
||||
#endif // !SHELL_ENABLE_METAL
|
||||
auto settings = CreateSettingsForFixture();
|
||||
settings.enable_impeller = true;
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, //
|
||||
GetTaskRunnersForFixture(), //
|
||||
false, //
|
||||
nullptr, //
|
||||
false, //
|
||||
ShellTestPlatformView::BackendType::kMetalBackend //
|
||||
);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.rendering_backend =
|
||||
ShellTestPlatformView::BackendType::kMetalBackend,
|
||||
}),
|
||||
});
|
||||
|
||||
AddNativeCallback("NativeOnBeforeToImageSync",
|
||||
CREATE_NATIVE_ENTRY([&](auto args) {
|
||||
@@ -4006,14 +4041,13 @@ TEST_F(ShellTest, PictureToImageSyncWithTrampledContext) {
|
||||
task_runner);
|
||||
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, //
|
||||
task_runners, //
|
||||
false, //
|
||||
nullptr, //
|
||||
false, //
|
||||
ShellTestPlatformView::BackendType::kGLBackend //
|
||||
);
|
||||
std::unique_ptr<Shell> shell = CreateShell({
|
||||
.settings = settings,
|
||||
.task_runners = task_runners,
|
||||
.platform_view_create_callback = ShellTestPlatformViewBuilder({
|
||||
.rendering_backend = ShellTestPlatformView::BackendType::kGLBackend,
|
||||
}),
|
||||
});
|
||||
|
||||
AddNativeCallback(
|
||||
"NativeOnBeforeToImageSync", CREATE_NATIVE_ENTRY([&](auto args) {
|
||||
@@ -4048,8 +4082,7 @@ TEST_F(ShellTest, PictureToImageSyncWithTrampledContext) {
|
||||
|
||||
TEST_F(ShellTest, PluginUtilitiesCallbackHandleErrorHandling) {
|
||||
auto settings = CreateSettingsForFixture();
|
||||
std::unique_ptr<Shell> shell =
|
||||
CreateShell(settings, GetTaskRunnersForFixture());
|
||||
std::unique_ptr<Shell> shell = CreateShell(settings);
|
||||
|
||||
fml::AutoResetWaitableEvent latch;
|
||||
bool test_passed;
|
||||
|
||||
@@ -44,8 +44,8 @@ class MockPlatformMessageResponse : public PlatformMessageResponse {
|
||||
|
||||
@implementation PlatformMessageHandlerIosTest
|
||||
- (void)testCreate {
|
||||
flutter::TaskRunners task_runners("test", GetCurrentTaskRunner(), CreateNewThread("raster"),
|
||||
CreateNewThread("ui"), CreateNewThread("io"));
|
||||
TaskRunners task_runners("test", GetCurrentTaskRunner(), CreateNewThread("raster"),
|
||||
CreateNewThread("ui"), CreateNewThread("io"));
|
||||
auto handler = std::make_unique<PlatformMessageHandlerIos>(task_runners.GetPlatformTaskRunner());
|
||||
XCTAssertTrue(handler);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user