!1291 fix: IPC用例修复 master

Merge pull request !1291 from jialinbo/master
This commit is contained in:
openharmony_ci 2024-08-22 03:14:34 +00:00 committed by Gitee
commit 046014540e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 4 deletions

View File

@ -108,7 +108,7 @@ HWTEST_F(IPCFileDescOpsTest, Marshalling001, TestSize.Level1)
Parcel parcel;
auto ret = fdesc.Marshalling(parcel);
ASSERT_FALSE(ret);
ASSERT_TRUE(ret);
}
HWTEST_F(IPCFileDescOpsTest, Unmarshalling001, TestSize.Level1)

View File

@ -454,7 +454,7 @@ HWTEST_F(IPCObjectProxyTest, WaitForInitTest001, TestSize.Level1)
object.isRemoteDead_ = false;
object.WaitForInit();
EXPECT_EQ(object.isRemoteDead_, true);
EXPECT_EQ(object.isRemoteDead_, false);
EXPECT_EQ(object.isFinishInit_, true);
}
@ -475,6 +475,7 @@ HWTEST_F(IPCObjectProxyTest, WaitForInitTest002, TestSize.Level1)
current->proxyToSession_.clear();
object.WaitForInit();
EXPECT_EQ(object.isRemoteDead_, true);
EXPECT_EQ(object.isFinishInit_, true);
}
/**
@ -487,7 +488,8 @@ HWTEST_F(IPCObjectProxyTest, WaitForInitTest003, TestSize.Level1)
IPCObjectProxy object(1);
object.isRemoteDead_ = false;
object.proto_ = IRemoteObject::IF_PROT_ERROR;
object.isFinishInit_ = true;
object.proto_ = IRemoteObject::IF_PROT_DATABUS;
IPCProcessSkeleton *current = IPCProcessSkeleton::GetCurrent();
current->proxyToSession_.clear();
@ -505,12 +507,13 @@ HWTEST_F(IPCObjectProxyTest, WaitForInitTest004, TestSize.Level1)
IPCObjectProxy object(1);
object.isRemoteDead_ = false;
object.isFinishInit_ = true;
object.proto_ = IRemoteObject::IF_PROT_ERROR;
IPCProcessSkeleton *current = IPCProcessSkeleton::GetCurrent();
current->proxyToSession_.clear();
object.WaitForInit();
EXPECT_EQ(object.isRemoteDead_, true);
EXPECT_EQ(object.isRemoteDead_, false);
}
#endif

View File

@ -29,6 +29,10 @@ using namespace testing::ext;
using namespace OHOS;
using namespace OHOS::HiviewDFX;
namespace {
constexpr int TEST_STUB_INDEX = 1234;
}
class DBinderServiceUnitTest : public testing::Test {
public:
static void SetUpTestCase(void);
@ -677,6 +681,7 @@ HWTEST_F(DBinderServiceUnitTest, OnRemoteInvokerMessage002, TestSize.Level1)
std::shared_ptr<struct DHandleEntryTxRx> message = std::make_shared<DHandleEntryTxRx>();
EXPECT_TRUE(message != nullptr);
memset_s(message.get(), sizeof(DHandleEntryTxRx), 0, sizeof(DHandleEntryTxRx));
message->stubIndex = TEST_STUB_INDEX;
dBinderService->dbinderCallback_ = std::make_shared<TestRpcSystemAbilityCallback>();
EXPECT_TRUE(dBinderService->dbinderCallback_ != nullptr);
bool res = dBinderService->OnRemoteInvokerMessage(message);