• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #include "client_info_manager_mock.h"
17 #include "disc_client_proxy_standard.h"
18 #include "remote_object_mock.h"
19 
20 namespace OHOS {
GetInstance()21 SoftbusClientInfoManager &SoftbusClientInfoManager::GetInstance()
22 {
23     static SoftbusClientInfoManager instance;
24     return instance;
25 }
26 
GetSoftbusClientProxy(const std::string & pkgName)27 sptr<IRemoteObject> SoftbusClientInfoManager::GetSoftbusClientProxy(const std::string &pkgName)
28 {
29     return ClientInfoManagerMock::Get()->GetSoftbusClientProxy(pkgName);
30 }
31 
Get()32 ClientInfoManagerMock* ClientInfoManagerMock::Get()
33 {
34     return instance_;
35 }
36 
ClientInfoManagerMock()37 ClientInfoManagerMock::ClientInfoManagerMock()
38 {
39     instance_ = this;
40 }
41 
~ClientInfoManagerMock()42 ClientInfoManagerMock::~ClientInfoManagerMock()
43 {
44     instance_ = nullptr;
45 }
46 
SetupStub()47 void ClientInfoManagerMock::SetupStub()
48 {
49     EXPECT_CALL(*this, GetSoftbusClientProxy).WillRepeatedly(ActionOfGetSoftBusClientProxy);
50 }
51 
ActionOfGetSoftBusClientProxy(const std::string & pkgName)52 sptr<IRemoteObject> ClientInfoManagerMock::ActionOfGetSoftBusClientProxy(const std::string &pkgName)
53 {
54     return RemoteObjectMock::Get();
55 }
56 }