From 2c449aea008ceda9881edc4d557d2b24510eed63 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Tue, 24 May 2022 16:54:19 +0800 Subject: [PATCH] codecheck Signed-off-by: wangyb0625 --- common/include/dm_constants.h | 1 + .../native_cpp/src/ipc/standard/ipc_client_stub.cpp | 2 +- .../src/ipc/standard/ipc_server_stub.cpp | 2 +- test/unittest/UTTest_ipc_client_stub.cpp | 6 +++--- test/unittest/UTTest_ipc_server_stub.cpp | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 4ff3d02b3..fd401fdc7 100755 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -74,6 +74,7 @@ enum { ERR_DM_AUTH_NOT_START = -20026, ERR_DM_AUTH_MESSAGE_INCOMPLETE = -20027, ERR_DM_CREATE_GROUP_FAILED = -20028, + ERR_DM_IPC_READ_TOKEN_FAILED = -20029, }; const std::string TARGET_PKG_NAME_KEY = "targetPkgName"; diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp index 379dd0ef6..b330c97f4 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp @@ -29,7 +29,7 @@ int32_t IpcClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messa auto remoteDescriptor = data.ReadInterfaceToken(); if (GetDescriptor() != remoteDescriptor) { LOGI("ReadInterfaceToken fail!"); - return ERR_INVALID_STATE; + return ERR_DM_IPC_READ_TOKEN_FAILED; } if (IpcCmdRegister::GetInstance().OnIpcCmd((int32_t)code, data, reply) == DM_OK) { diff --git a/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp b/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp index bc054bedc..014125c2e 100644 --- a/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp +++ b/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp @@ -84,7 +84,7 @@ int32_t IpcServerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messa auto remoteDescriptor = data.ReadInterfaceToken(); if (GetDescriptor() != remoteDescriptor) { LOGI("ReadInterfaceToken fail!"); - return ERR_INVALID_STATE; + return ERR_DM_IPC_READ_TOKEN_FAILED; } int32_t ret = IpcCmdRegister::GetInstance().OnIpcCmd((int32_t)code, data, reply); diff --git a/test/unittest/UTTest_ipc_client_stub.cpp b/test/unittest/UTTest_ipc_client_stub.cpp index 30715f4bc..7b5e68f46 100644 --- a/test/unittest/UTTest_ipc_client_stub.cpp +++ b/test/unittest/UTTest_ipc_client_stub.cpp @@ -87,7 +87,7 @@ HWTEST_F(IpcClientStubTest, OnRemoteRequest_001, testing::ext::TestSize.Level0) * set MessageParcel not null * 2. set set code is SERVER_DEVICE_FA_NOTIFY * 3. call IpcClientStub OnRemoteRequest with parameter - * 4. check result is ERR_INVALID_STATE + * 4. check result is ERR_DM_IPC_READ_TOKEN_FAILED * @tc.type: FUNC * @tc.require: AR000GHSJK */ @@ -104,8 +104,8 @@ HWTEST_F(IpcClientStubTest, OnRemoteRequest_002, testing::ext::TestSize.Level0) sptr instance = new IpcClientStub(); // 3. call IpcClientStub OnRemoteRequest with parameter int ret = instance->OnRemoteRequest(code, data, reply, option); - // 4. check result is ERR_INVALID_STATE - ASSERT_EQ(ret, ERR_INVALID_STATE); + // 4. check result is ERR_DM_IPC_READ_TOKEN_FAILED + ASSERT_EQ(ret, ERR_DM_IPC_READ_TOKEN_FAILED); } /** diff --git a/test/unittest/UTTest_ipc_server_stub.cpp b/test/unittest/UTTest_ipc_server_stub.cpp index a4686000d..1e929f94d 100644 --- a/test/unittest/UTTest_ipc_server_stub.cpp +++ b/test/unittest/UTTest_ipc_server_stub.cpp @@ -168,8 +168,8 @@ HWTEST_F(IpcServerStubTest, OnRemoteRequest_002, testing::ext::TestSize.Level0) int ret = 0; // 2. Call IpcServerStub OnRemoteRequest with param ret = IpcServerStub::GetInstance().OnRemoteRequest(code, data, reply, option); - // 3. check ret not ERR_INVALID_STATE - ASSERT_EQ(ret, ERR_INVALID_STATE); + // 3. check ret not ERR_DM_IPC_READ_TOKEN_FAILED + ASSERT_EQ(ret, ERR_DM_IPC_READ_TOKEN_FAILED); } /** -- Gitee