• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef MOCK_VSYNC_VSYNC_DISTRIBUTOR_H
17 #define MOCK_VSYNC_VSYNC_DISTRIBUTOR_H
18 
19 #include "vsync_distributor.h"
20 namespace OHOS {
21 namespace Rosen {
22 
23 class MockVSyncDistributor : public VSyncDistributor {
24 public:
25     MockVSyncDistributor(sptr<VSyncController> controller, std::string name, DVSyncFeatureParam dvsyncParam = {})
VSyncDistributor(controller,name,dvsyncParam)26         : VSyncDistributor(controller, name, dvsyncParam) {}
~MockVSyncDistributor()27     ~MockVSyncDistributor() {};
28     // nocopyable
29     MockVSyncDistributor(const MockVSyncDistributor &) = delete;
30     MockVSyncDistributor &operator=(const MockVSyncDistributor &) = delete;
31 
NeedUpdateVSyncTime(int32_t & pid)32     bool NeedUpdateVSyncTime(int32_t& pid)
33     {
34         pid = mockPid_;
35         return needUpdateVsyncTime_;
36     }
37 
DVSyncUpdate(uint64_t dvsyncTime,uint64_t vsyncTime)38     void DVSyncUpdate(uint64_t dvsyncTime, uint64_t vsyncTime)
39     {
40         dvsyncTime_ = dvsyncTime;
41         vsyncTime_ = vsyncTime;
42     }
43 
GetUiCommandDelayTime()44     int64_t GetUiCommandDelayTime() { return delayTime_; }
GetLastUpdateTime()45     int64_t GetLastUpdateTime() { return lastTimeStamp_; }
46     int32_t mockPid_ = 0;
47     bool needUpdateVsyncTime_ = false;
48     int64_t lastTimeStamp_ = 0;
49     int64_t delayTime_ = 0;
50     uint64_t dvsyncTime_ = 0;
51     uint64_t vsyncTime_ = 0;
52 };
53 }
54 }
55 
56 #endif