• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core_service_ipc_interface_code.h"
17 #include "esim_core_service_stub_test.h"
18 #include "telephony_errors.h"
19 #include "telephony_log_wrapper.h"
20 #include "gtest/gtest.h"
21 
22 using namespace testing::ext;
23 namespace OHOS {
24 namespace Telephony {
25 class EsimCoreServiceStubTest : public testing::Test {
26 public:
27     static void SetUpTestCase();
28     static void TearDownTestCase();
29     void SetUp();
30     void TearDown();
31     static inline std::shared_ptr<CoreServiceStub> instance_ = std::make_shared<MockCoreServiceStub>();
32     static int32_t SendRemoteRequest(MessageParcel &data, CoreServiceInterfaceCode code);
33 };
34 
SetUpTestCase()35 void EsimCoreServiceStubTest::SetUpTestCase() {}
36 
TearDownTestCase()37 void EsimCoreServiceStubTest::TearDownTestCase() {}
38 
SetUp()39 void EsimCoreServiceStubTest::SetUp() {}
40 
TearDown()41 void EsimCoreServiceStubTest::TearDown() {}
42 
SendRemoteRequest(MessageParcel & data,CoreServiceInterfaceCode code)43 int32_t EsimCoreServiceStubTest::SendRemoteRequest(MessageParcel &data, CoreServiceInterfaceCode code)
44 {
45     MessageParcel reply;
46     MessageOption option;
47     return instance_->OnRemoteRequest(static_cast<uint32_t>(code), data, reply, option);
48 }
49 
50 HWTEST_F(EsimCoreServiceStubTest, OnSendApduData_001, Function | MediumTest | Level2)
51 {
52     MessageParcel data;
53     ASSERT_TRUE(data.WriteInterfaceToken(CoreServiceStub::GetDescriptor()));
54     int32_t ret = SendRemoteRequest(data, CoreServiceInterfaceCode::SEND_APDU_DATA);
55     EXPECT_EQ(ret, TELEPHONY_ERR_SUCCESS);
56 }
57 
58 } // namespace Telephony
59 } // namespace OHOS
60