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 #include <gtest/gtest.h> 17 18 #include "dcamera_sink_callback_proxy.h" 19 #include "distributed_camera_errno.h" 20 #include "distributed_camera_constants.h" 21 #include "distributed_camera_sink_proxy.h" 22 #include "distributed_hardware_log.h" 23 #include "if_system_ability_manager.h" 24 #include "iservice_registry.h" 25 26 using namespace testing::ext; 27 28 namespace OHOS { 29 namespace DistributedHardware { 30 class DcameraSinkCallbackProxyTest : public testing::Test { 31 public: 32 static void SetUpTestCase(void); 33 static void TearDownTestCase(void); 34 void SetUp(); 35 void TearDown(); 36 }; 37 SetUpTestCase(void)38void DcameraSinkCallbackProxyTest::SetUpTestCase(void) 39 { 40 DHLOGI("DcameraSinkCallbackProxyTest::SetUpTestCase"); 41 } 42 TearDownTestCase(void)43void DcameraSinkCallbackProxyTest::TearDownTestCase(void) 44 { 45 DHLOGI("DcameraSinkCallbackProxyTest::TearDownTestCase"); 46 } 47 SetUp(void)48void DcameraSinkCallbackProxyTest::SetUp(void) 49 { 50 DHLOGI("DcameraSinkCallbackProxyTest::SetUp"); 51 } 52 TearDown(void)53void DcameraSinkCallbackProxyTest::TearDown(void) 54 { 55 DHLOGI("DcameraSinkCallbackProxyTest::TearDown"); 56 } 57 58 /** 59 * @tc.name: dcamera_sink_callback_proxy_test_001 60 * @tc.desc: Verify the OnNotifyResourceInfo function. 61 * @tc.type: FUNC 62 * @tc.require: issue 63 */ 64 HWTEST_F(DcameraSinkCallbackProxyTest, dcamera_sink_callback_proxy_test_001, TestSize.Level1) 65 { 66 DHLOGI("DcameraSinkCallbackProxyTest::dcamera_sink_callback_proxy_test_001"); 67 sptr<ISystemAbilityManager> samgr = 68 SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 69 sptr<IRemoteObject> remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID); 70 sptr<DCameraSinkCallbackProxy> callbackProxy(new DCameraSinkCallbackProxy(remoteObject)); 71 EXPECT_EQ(false, callbackProxy == nullptr); 72 } 73 } // namespace DistributedHardware 74 } // namespace OHOS