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