blob: 90e716ff1ff4429f82fff84ad02664f0149cf607 [file] [log] [blame]
Dominik Laskowskia42d5392022-09-29 14:26:53 -04001/*
2 * Copyright 2023 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#pragma once
18
19#include "DisplayTransactionTestHelpers.h"
20
21namespace android {
22
23template <hal::PowerMode kInnerDisplayPowerMode, hal::PowerMode kOuterDisplayPowerMode,
24 bool kExpectSetPowerModeOnce = true>
25struct DualDisplayTransactionTest : DisplayTransactionTest {
26 static constexpr bool kWithMockScheduler = false;
27 DualDisplayTransactionTest() : DisplayTransactionTest(kWithMockScheduler) {}
28
29 void SetUp() override {
30 injectMockScheduler(kInnerDisplayId);
31
32 {
33 InnerDisplayVariant::injectHwcDisplay<kInnerDisplayPowerMode, kExpectSetPowerModeOnce>(
34 this);
35
36 auto injector = InnerDisplayVariant::makeFakeExistingDisplayInjector(this);
37 injector.setRefreshRateSelector(mFlinger.scheduler()->refreshRateSelector());
38 injector.setPowerMode(kInnerDisplayPowerMode);
39 mInnerDisplay = injector.inject();
40 }
41 {
42 OuterDisplayVariant::injectHwcDisplay<kOuterDisplayPowerMode, kExpectSetPowerModeOnce>(
43 this);
44
45 auto injector = OuterDisplayVariant::makeFakeExistingDisplayInjector(this);
46 injector.setPowerMode(kOuterDisplayPowerMode);
47 mOuterDisplay = injector.inject();
48 }
49 }
50
51 static inline PhysicalDisplayId kInnerDisplayId = InnerDisplayVariant::DISPLAY_ID::get();
52 static inline PhysicalDisplayId kOuterDisplayId = OuterDisplayVariant::DISPLAY_ID::get();
53
54 sp<DisplayDevice> mInnerDisplay, mOuterDisplay;
55};
56
57} // namespace android