• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2  * Copyright (c) 2024 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 HSTREAM_DEPTH_PROXY_FUZZER_H
17 #define HSTREAM_DEPTH_PROXY_FUZZER_H
18 
19 #include "hstream_depth_data_proxy.h"
20 #include "system_ability_definition.h"
21 #include "iservice_registry.h"
22 #include "token_setproc.h"
23 
24 namespace OHOS {
25 namespace CameraStandard {
26 
27 class IRemoteObjectMock : public IRemoteObject {
28 public:
GetObjectRefCount()29     inline int32_t GetObjectRefCount() override
30     {
31         return 0;
32     }
SendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)33     inline int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override
34     {
35         return 0;
36     }
AddDeathRecipient(const sptr<DeathRecipient> & recipient)37     inline bool AddDeathRecipient(const sptr<DeathRecipient> &recipient) override
38     {
39         return true;
40     }
RemoveDeathRecipient(const sptr<DeathRecipient> & recipient)41     inline bool RemoveDeathRecipient(const sptr<DeathRecipient> &recipient) override
42     {
43         return true;
44     }
Dump(int fd,const std::vector<std::u16string> & args)45     inline int Dump(int fd, const std::vector<std::u16string> &args) override
46     {
47         return 0;
48     }
49 };
50 
51 class IStreamDepthDataCallbackMock : public IStreamDepthDataCallback, public IRemoteObjectMock {
52 public:
OnDepthDataError(int32_t errorCode)53     inline int32_t OnDepthDataError(int32_t errorCode) override
54     {
55         return 0;
56     }
AsObject()57     sptr<IRemoteObject> AsObject() override
58     {
59         return nullptr;
60     }
61 };
62 
63 class HStreamDepthDataProxyFuzzer {
64 public:
65 static std::shared_ptr<HStreamDepthDataProxy> fuzz_;
66 static void HStreamDepthDataProxyFuzzTest();
67 };
68 } //CameraStandard
69 } //OHOS
70 #endif //HSTREAM_DEPTH_PROXY_FUZZER_H