• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 #pragma once
18 
19 #include <composer-hal/2.4/ComposerClient.h>
20 
21 #include <gmock/gmock.h>
22 
23 using namespace android::hardware::graphics::common;
24 using namespace android::hardware::graphics::composer;
25 using namespace android::hardware::graphics::composer::V2_4;
26 using namespace android::hardware::graphics::composer::V2_4::hal;
27 using namespace android::hardware;
28 using namespace std::chrono_literals;
29 
30 namespace sftest {
31 
32 // Mock class for ComposerHal. Implements only the functions used in the test.
33 class MockComposerHal {
34 public:
35     MOCK_METHOD2(getActiveConfig, V2_1::Error(Display, Config*));
36     MOCK_METHOD4(getDisplayAttribute_2_4,
37                  V2_4::Error(Display, Config, V2_4::IComposerClient::Attribute, int32_t*));
38     MOCK_METHOD2(getDisplayConfigs, V2_1::Error(Display, hidl_vec<Config>*));
39     MOCK_METHOD2(setActiveConfig, V2_1::Error(Display, Config));
40     MOCK_METHOD2(getDisplayVsyncPeriod, V2_4::Error(Display, V2_4::VsyncPeriodNanos*));
41     MOCK_METHOD4(setActiveConfigWithConstraints,
42                  V2_4::Error(Display, Config,
43                              const V2_4::IComposerClient::VsyncPeriodChangeConstraints&,
44                              VsyncPeriodChangeTimeline*));
45 };
46 
47 } // namespace sftest