5#include "flutter/shell/platform/android/android_context_gl_impeller.h"
6#include "gmock/gmock.h"
7#include "gtest/gtest.h"
13using ::testing::AllOf;
14using ::testing::ByMove;
15using ::testing::Field;
16using ::testing::Matcher;
17using ::testing::Return;
19using ::impeller::egl::Config;
20using ::impeller::egl::ConfigDescriptor;
25 MOCK_METHOD(
bool, IsValid, (), (
const,
override));
26 MOCK_METHOD(std::unique_ptr<Config>,
34 auto display = std::make_unique<MockDisplay>();
35 EXPECT_CALL(*display, IsValid).WillRepeatedly(Return(
true));
36 auto first_result = std::make_unique<Config>(ConfigDescriptor(), EGLConfig());
38 std::make_unique<Config>(ConfigDescriptor(), EGLConfig());
41 ChooseConfig(Matcher<ConfigDescriptor>(AllOf(
43 Field(&ConfigDescriptor::surface_type,
45 .WillOnce(Return(ByMove(std::move(first_result))));
46 EXPECT_CALL(*display, ChooseConfig(Matcher<ConfigDescriptor>(
47 Field(&ConfigDescriptor::surface_type,
49 .WillOnce(Return(ByMove(std::move(second_result))));
50 ON_CALL(*display, ChooseConfig(_))
51 .WillByDefault(Return(ByMove(std::unique_ptr<Config>())));
53 std::make_unique<AndroidContextGLImpeller>(std::move(display),
true);
58 auto display = std::make_unique<MockDisplay>();
59 EXPECT_CALL(*display, IsValid).WillRepeatedly(Return(
true));
60 std::unique_ptr<Config> first_result;
62 std::make_unique<Config>(ConfigDescriptor(), EGLConfig());
63 auto third_result = std::make_unique<Config>(ConfigDescriptor(), EGLConfig());
66 ChooseConfig(Matcher<ConfigDescriptor>(AllOf(
68 Field(&ConfigDescriptor::surface_type,
70 .WillOnce(Return(ByMove(std::move(first_result))));
73 ChooseConfig(Matcher<ConfigDescriptor>(
75 Field(&ConfigDescriptor::surface_type,
77 .WillOnce(Return(ByMove(std::move(second_result))));
78 EXPECT_CALL(*display, ChooseConfig(Matcher<ConfigDescriptor>(
79 Field(&ConfigDescriptor::surface_type,
81 .WillOnce(Return(ByMove(std::move(third_result))));
82 ON_CALL(*display, ChooseConfig(_))
83 .WillByDefault(Return(ByMove(std::unique_ptr<Config>())));
85 std::make_unique<AndroidContextGLImpeller>(std::move(display),
true);
A connection to an EGL display. Only one connection per application instance is sufficient.
TEST(DisplayListComplexity, EmptyDisplayList)