Lloyd Pique | f58625d | 2017-12-19 13:22:33 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 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 | #undef LOG_TAG |
| 18 | #define LOG_TAG "LibSurfaceFlingerUnittests" |
| 19 | |
| 20 | #include <gmock/gmock.h> |
| 21 | #include <gtest/gtest.h> |
| 22 | |
| 23 | #include <log/log.h> |
| 24 | |
| 25 | #include "TestableSurfaceFlinger.h" |
| 26 | |
| 27 | namespace android { |
| 28 | namespace { |
| 29 | |
| 30 | class DisplayTransactionTest : public testing::Test { |
| 31 | protected: |
| 32 | DisplayTransactionTest(); |
| 33 | ~DisplayTransactionTest() override; |
| 34 | |
| 35 | void setupComposer(int virtualDisplayCount); |
| 36 | void setupPrimaryDisplay(int width, int height); |
| 37 | |
| 38 | TestableSurfaceFlinger mFlinger; |
| 39 | }; |
| 40 | |
| 41 | DisplayTransactionTest::DisplayTransactionTest() { |
| 42 | const ::testing::TestInfo* const test_info = |
| 43 | ::testing::UnitTest::GetInstance()->current_test_info(); |
| 44 | ALOGD("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name()); |
| 45 | } |
| 46 | |
| 47 | DisplayTransactionTest::~DisplayTransactionTest() { |
| 48 | const ::testing::TestInfo* const test_info = |
| 49 | ::testing::UnitTest::GetInstance()->current_test_info(); |
| 50 | ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name()); |
| 51 | } |
| 52 | |
| 53 | TEST_F(DisplayTransactionTest, PlaceholderTrivialTest) { |
| 54 | auto result = mFlinger.getDefaultDisplayDeviceLocked(); |
| 55 | EXPECT_EQ(nullptr, result.get()); |
| 56 | |
| 57 | EXPECT_EQ(nullptr, mFlinger.mutableBuiltinDisplays()[0].get()); |
| 58 | mFlinger.mutableBuiltinDisplays()[0] = new BBinder(); |
| 59 | EXPECT_NE(nullptr, mFlinger.mutableBuiltinDisplays()[0].get()); |
| 60 | } |
| 61 | |
| 62 | } // namespace |
| 63 | } // namespace android |