xref: /aosp_15_r20/frameworks/native/services/surfaceflinger/tests/unittests/mock/MockVSyncTracker.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1 /*
2  * Copyright 2020 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 <gmock/gmock.h>
20 
21 #include <scheduler/FrameTime.h>
22 
23 #include "Scheduler/VSyncTracker.h"
24 
25 namespace android::mock {
26 
27 class VSyncTracker : public android::scheduler::VSyncTracker {
28 public:
29     VSyncTracker();
30     ~VSyncTracker() override;
31 
32     MOCK_METHOD(bool, addVsyncTimestamp, (nsecs_t), (override));
33     MOCK_METHOD(nsecs_t, nextAnticipatedVSyncTimeFrom, (nsecs_t, std::optional<nsecs_t>),
34                 (override));
35     MOCK_METHOD(nsecs_t, currentPeriod, (), (const, override));
36     MOCK_METHOD(Period, minFramePeriod, (), (const, override));
37     MOCK_METHOD(void, resetModel, (), (override));
38     MOCK_METHOD(bool, needsMoreSamples, (), (const, override));
39     MOCK_METHOD(bool, isVSyncInPhase, (nsecs_t, Fps), (override));
40     MOCK_METHOD(void, setDisplayModePtr, (ftl::NonNull<DisplayModePtr>), (override));
41     MOCK_METHOD(void, setRenderRate, (Fps, bool), (override));
42     MOCK_METHOD(void, onFrameBegin, (TimePoint, scheduler::FrameTime), (override));
43     MOCK_METHOD(void, onFrameMissed, (TimePoint), (override));
44     MOCK_METHOD(void, dump, (std::string&), (const, override));
45     MOCK_METHOD(bool, isCurrentMode, (const ftl::NonNull<DisplayModePtr>&), (const, override));
46 };
47 
48 } // namespace android::mock
49