1 /* 2 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 "mock_wfd_source_scene.h" 17 18 using namespace std; 19 using namespace OHOS::Wifi; 20 21 namespace OHOS { 22 namespace Sharing { 23 MockInitialize()24void MockWfdSourceScene::MockInitialize() 25 { 26 SHARING_LOGD("trace."); 27 wfdP2pCallback_ = new WfdP2pCallback(shared_from_this()); 28 mockIpcAdapter_ = make_shared<MockIpcMsgAdapter>(); 29 mockSharingAdapter_ = make_shared<MockSharingAdapter>(); 30 mockWifiP2pInstance_ = make_shared<MockWifiP2p>(); 31 32 SetIpcAdapter(mockIpcAdapter_); 33 sharingAdapter_ = mockSharingAdapter_; 34 p2pInstance_ = mockWifiP2pInstance_; 35 } 36 MockGetP2pInstance()37std::shared_ptr<Wifi::WifiP2p> MockWfdSourceScene::MockGetP2pInstance() 38 { 39 return p2pInstance_; 40 } 41 MockGetIpcAdapter()42std::shared_ptr<IpcMsgAdapter> MockWfdSourceScene::MockGetIpcAdapter() 43 { 44 return ipcAdapter_.lock(); 45 } 46 MockGetSharingAdapter()47std::shared_ptr<ISharingAdapter> MockWfdSourceScene::MockGetSharingAdapter() 48 { 49 return sharingAdapter_.lock(); 50 } 51 52 } // namespace Sharing 53 } // namespace OHOS 54