xref: /aosp_15_r20/frameworks/native/services/surfaceflinger/tests/unittests/LayerTestUtils.cpp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1 /*
2  * Copyright 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "LayerTestUtils.h"
18 
19 namespace android {
20 
createLayer(TestableSurfaceFlinger & flinger)21 sp<Layer> BufferStateLayerFactory::createLayer(TestableSurfaceFlinger& flinger) {
22     sp<Client> client;
23     LayerCreationArgs args(flinger.flinger(), client, "buffer-state-layer", LAYER_FLAGS,
24                            LayerMetadata());
25     return sp<Layer>::make(args);
26 }
27 
createLayer(TestableSurfaceFlinger & flinger)28 sp<Layer> EffectLayerFactory::createLayer(TestableSurfaceFlinger& flinger) {
29     sp<Client> client;
30     LayerCreationArgs args(flinger.flinger(), client, "color-layer", LAYER_FLAGS, LayerMetadata());
31     return sp<Layer>::make(args);
32 }
33 
PrintToStringParamName(const::testing::TestParamInfo<std::shared_ptr<LayerFactory>> & info)34 std::string PrintToStringParamName(
35         const ::testing::TestParamInfo<std::shared_ptr<LayerFactory>>& info) {
36     return info.param->name();
37 }
38 
BaseLayerTest()39 BaseLayerTest::BaseLayerTest() {
40     mFlinger.setupMockScheduler();
41 }
42 
43 } // namespace android
44