blob: 787f973215f7e34c184b6779575f6f20c2c15198 [file] [log] [blame]
Lloyd Piquefeb73d72018-12-04 17:23:44 -08001/*
2 * Copyright 2019 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 <gtest/gtest.h>
18
19#include <compositionengine/LayerCreationArgs.h>
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070020#include <compositionengine/LayerFECompositionState.h>
Lloyd Piquefeb73d72018-12-04 17:23:44 -080021#include <compositionengine/impl/Layer.h>
22#include <compositionengine/mock/CompositionEngine.h>
23#include <compositionengine/mock/LayerFE.h>
24
25namespace android::compositionengine {
26namespace {
27
28using testing::StrictMock;
29
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070030struct LayerTest : public testing::Test {
31 struct Layer final : public impl::Layer {
32 explicit Layer(const LayerCreationArgs& args) : mLayerFE(args.layerFE) {}
33 ~Layer() override = default;
34
35 // compositionengine::Layer overrides
36 sp<LayerFE> getLayerFE() const { return mLayerFE.promote(); }
37 const LayerFECompositionState& getFEState() const override { return mFrontEndState; }
38 LayerFECompositionState& editFEState() override { return mFrontEndState; }
39
40 // compositionengine::impl::Layer overrides
41 void dumpFEState(std::string& out) const override { mFrontEndState.dump(out); }
42
43 const wp<LayerFE> mLayerFE;
44 LayerFECompositionState mFrontEndState;
45 };
46
Lloyd Piquefeb73d72018-12-04 17:23:44 -080047 ~LayerTest() override = default;
48
49 StrictMock<mock::CompositionEngine> mCompositionEngine;
50 sp<LayerFE> mLayerFE = new StrictMock<mock::LayerFE>();
Lloyd Piquea38ea7e2019-04-16 18:10:26 -070051 Layer mLayer{LayerCreationArgs{mLayerFE}};
Lloyd Piquefeb73d72018-12-04 17:23:44 -080052};
53
54/* ------------------------------------------------------------------------
55 * Basic construction
56 */
57
58TEST_F(LayerTest, canInstantiateLayer) {}
59
60} // namespace
61} // namespace android::compositionengine