1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/common/shell_test_platform_view.h"
6
7#ifdef SHELL_ENABLE_GL
8#include "flutter/shell/common/shell_test_platform_view_gl.h"
9#endif // SHELL_ENABLE_GL
10#ifdef SHELL_ENABLE_VULKAN
11#include "flutter/shell/common/shell_test_platform_view_vulkan.h"
12#endif // SHELL_ENABLE_VULKAN
13
14namespace flutter {
15namespace testing {
16
17std::unique_ptr<ShellTestPlatformView> ShellTestPlatformView::Create(
18 PlatformView::Delegate& delegate,
19 TaskRunners task_runners,
20 std::shared_ptr<ShellTestVsyncClock> vsync_clock,
21 CreateVsyncWaiter create_vsync_waiter,
22 BackendType backend,
23 std::shared_ptr<ShellTestExternalViewEmbedder>
24 shell_test_external_view_embedder) {
25 // TODO(gw280): https://github.com/flutter/flutter/issues/50298
26 // Make this fully runtime configurable
27 switch (backend) {
28 case BackendType::kDefaultBackend:
29#ifdef SHELL_ENABLE_GL
30 case BackendType::kGLBackend:
31 return std::make_unique<ShellTestPlatformViewGL>(
32 delegate, task_runners, vsync_clock, create_vsync_waiter,
33 shell_test_external_view_embedder);
34#endif // SHELL_ENABLE_GL
35#ifdef SHELL_ENABLE_VULKAN
36 case BackendType::kVulkanBackend:
37 return std::make_unique<ShellTestPlatformViewVulkan>(
38 delegate, task_runners, vsync_clock, create_vsync_waiter,
39 shell_test_external_view_embedder);
40#endif // SHELL_ENABLE_VULKAN
41 default:
42 FML_LOG(FATAL) << "No backends supported for ShellTestPlatformView";
43 return nullptr;
44 }
45}
46
47} // namespace testing
48} // namespace flutter
49