1 /*
2 * Copyright (c) 2022-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 "unprepare_d_input_call_back_test.h"
17
18 namespace OHOS {
19 namespace DistributedHardware {
20 namespace DistributedInput {
SetUp()21 void UnprepareDInputCallbackTest::SetUp()
22 {
23 }
24
TearDown()25 void UnprepareDInputCallbackTest::TearDown()
26 {
27 }
28
SetUpTestCase()29 void UnprepareDInputCallbackTest::SetUpTestCase()
30 {
31 }
32
TearDownTestCase()33 void UnprepareDInputCallbackTest::TearDownTestCase()
34 {
35 }
36
OnResult(const std::string & deviceId,const int32_t & status)37 void UnprepareDInputCallbackTest::TestUnprepareDInputCallbackStub::OnResult(const std::string &deviceId,
38 const int32_t &status)
39 {
40 deviceId_ = deviceId;
41 status_ = status;
42 }
43
44 HWTEST_F(UnprepareDInputCallbackTest, UnprepareDInputCallback01, testing::ext::TestSize.Level1)
45 {
46 sptr<IRemoteObject> callBackStubPtr(new TestUnprepareDInputCallbackStub());
47 ASSERT_NE(nullptr, callBackStubPtr);
48 UnprepareDInputCallbackProxy callBackProxy(callBackStubPtr);
49 std::string deviceId = "deviceId0";
50 int32_t status = 0;
51 callBackProxy.OnResult(deviceId, status);
52 EXPECT_STREQ(deviceId.c_str(), ((sptr<TestUnprepareDInputCallbackStub> &)callBackStubPtr)->deviceId_.c_str());
53 EXPECT_EQ(status, ((sptr<TestUnprepareDInputCallbackStub> &)callBackStubPtr)->status_);
54 }
55 } // namespace DistributedInput
56 } // namespace DistributedHardware
57 } // namespace OHOS