Flutter Engine
The Flutter Engine
shell_test_platform_view.h
Go to the documentation of this file.
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#ifndef FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_H_
6#define FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_H_
7
8#include "flutter/shell/common/platform_view.h"
9#include "flutter/shell/common/shell_test_external_view_embedder.h"
10#include "flutter/shell/common/vsync_waiters_test.h"
11
12namespace flutter {
13namespace testing {
14
16 public:
17 enum class BackendType {
18 kDefaultBackend = 0,
19 kGLBackend,
20 kVulkanBackend,
21 kMetalBackend,
22 };
23
24 static std::unique_ptr<ShellTestPlatformView> Create(
25 PlatformView::Delegate& delegate,
26 const TaskRunners& task_runners,
27 const std::shared_ptr<ShellTestVsyncClock>& vsync_clock,
28 const CreateVsyncWaiter& create_vsync_waiter,
30 const std::shared_ptr<ShellTestExternalViewEmbedder>&
31 shell_test_external_view_embedder,
32 const std::shared_ptr<const fml::SyncSwitch>&
33 is_gpu_disabled_sync_switch);
34
35 virtual void SimulateVSync() = 0;
36
37 protected:
39 const TaskRunners& task_runners)
40 : PlatformView(delegate, task_runners) {}
41
43};
44
45// Create a ShellTestPlatformView from configuration struct.
47 public:
48 struct Config {
49 bool simulate_vsync = false;
50 std::shared_ptr<ShellTestExternalViewEmbedder>
54 };
55
56 explicit ShellTestPlatformViewBuilder(Config config);
58
59 // Override operator () to make this class assignable to std::function.
60 std::unique_ptr<PlatformView> operator()(Shell& shell);
61
62 private:
63 Config config_;
64};
65
66} // namespace testing
67} // namespace flutter
68
69#endif // FLUTTER_SHELL_COMMON_SHELL_TEST_PLATFORM_VIEW_H_
const char * backend
Used to forward events from the platform view to interested subsystems. This forwarding is done by th...
Definition: platform_view.h:60
Platform views are created by the shell on the platform task runner. Unless explicitly specified,...
Definition: platform_view.h:51
std::unique_ptr< PlatformView > operator()(Shell &shell)
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView)
static std::unique_ptr< ShellTestPlatformView > Create(PlatformView::Delegate &delegate, const TaskRunners &task_runners, const std::shared_ptr< ShellTestVsyncClock > &vsync_clock, const CreateVsyncWaiter &create_vsync_waiter, BackendType backend, const std::shared_ptr< ShellTestExternalViewEmbedder > &shell_test_external_view_embedder, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
ShellTestPlatformView(PlatformView::Delegate &delegate, const TaskRunners &task_runners)
std::function< std::unique_ptr< VsyncWaiter >()> CreateVsyncWaiter
std::shared_ptr< ShellTestExternalViewEmbedder > shell_test_external_view_embedder