blob: 295abc897e849b3095dce38e3f0fbb3ec942eda1 [file] [log] [blame]
Lloyd Pique70d91362018-10-18 16:02:55 -07001/*
2 * Copyright 2018 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 <compositionengine/impl/CompositionEngine.h>
18#include <gtest/gtest.h>
19
Lloyd Pique441d5042018-10-18 16:49:51 -070020#include "MockHWComposer.h"
21
Lloyd Pique70d91362018-10-18 16:02:55 -070022namespace android::compositionengine {
23namespace {
24
Lloyd Pique441d5042018-10-18 16:49:51 -070025using ::testing::StrictMock;
26
Lloyd Pique70d91362018-10-18 16:02:55 -070027class CompositionEngineTest : public testing::Test {
28public:
29 ~CompositionEngineTest() override;
30
Lloyd Pique441d5042018-10-18 16:49:51 -070031 mock::HWComposer* mHwc = new StrictMock<mock::HWComposer>();
32 impl::CompositionEngine mEngine;
Lloyd Pique70d91362018-10-18 16:02:55 -070033};
34
35CompositionEngineTest::~CompositionEngineTest() = default;
36
37TEST_F(CompositionEngineTest, canInstantiateCompositionEngine) {
38 auto engine = impl::createCompositionEngine();
39 EXPECT_TRUE(engine.get() != nullptr);
40}
41
Lloyd Pique441d5042018-10-18 16:49:51 -070042TEST_F(CompositionEngineTest, canSetHWComposer) {
43 mEngine.setHwComposer(std::unique_ptr<android::HWComposer>(mHwc));
44
45 EXPECT_EQ(mHwc, &mEngine.getHwComposer());
46}
47
Lloyd Pique70d91362018-10-18 16:02:55 -070048} // namespace
49} // namespace android::compositionengine