提交 2dc61afd 编写于 作者: 1 18392170496

Fix ut err

Sig:SIG_ApplicationFramework
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: N@ma-gentang <magentang3@huawei.com>
Signed-off-by: N18392170496 <magentang3@huawei.com>
上级 4923df2e
......@@ -396,24 +396,6 @@ HWTEST_F(BinderInvokerUnitTest, StartWorkLoopTest001, TestSize.Level1)
EXPECT_TRUE(binderInvoker.isMainWorkThread == false);
}
/**
* @tc.name: OnTransactionTest001
* @tc.desc: Override OnTransaction branch
* @tc.type: FUNC
*/
HWTEST_F(BinderInvokerUnitTest, OnTransactionTest001, TestSize.Level1)
{
BinderInvoker binderInvoker;
binder_transaction_data tr {};
tr.offsets_size = 1;
binderInvoker.input_.WriteBuffer(&tr, sizeof(binder_transaction_data));
const uint8_t* buffer = binderInvoker.input_.ReadBuffer(sizeof(binder_transaction_data));
binderInvoker.OnTransaction(buffer);
EXPECT_TRUE(tr.offsets_size > 0);
EXPECT_TRUE(binderInvoker.binderConnector_->IsAccessTokenSupported());
EXPECT_TRUE(tr.target.ptr == 0);
}
/**
* @tc.name: HandleCommandsTest001
* @tc.desc: Override HandleCommands branch
......
......@@ -776,7 +776,8 @@ HWTEST_F(IPCDbinderDataBusInvokerTest, OnMessageAvailable002, TestSize.Level1)
uint32_t size = sizeof(dbinder_transaction_data) + SOCKET_MAX_BUFF_SIZE;
dbinder_transaction_data *tmp = (dbinder_transaction_data *)malloc(size);
EXPECT_TRUE(tmp != nullptr);
ASSERT_TRUE(tmp != nullptr);
memset_s(tmp, size, 0, size);
data = reinterpret_cast<const char *>(tmp);
ssize_t len = 0;
......@@ -800,7 +801,8 @@ HWTEST_F(IPCDbinderDataBusInvokerTest, OnMessageAvailable003, TestSize.Level1)
std::shared_ptr<MockSessionImpl> sessionMock = std::make_shared<MockSessionImpl>();
uint32_t size = sizeof(dbinder_transaction_data) + SOCKET_MAX_BUFF_SIZE;
dbinder_transaction_data *tmp = (dbinder_transaction_data *)malloc(size);
EXPECT_TRUE(tmp != nullptr);
ASSERT_TRUE(tmp != nullptr);
memset_s(tmp, size, 0, size);
tmp->magic = DBINDER_MAGICWORD;
tmp->cmd = BC_SEND_RAWDATA;
......@@ -828,7 +830,8 @@ HWTEST_F(IPCDbinderDataBusInvokerTest, OnMessageAvailable004, TestSize.Level1)
std::shared_ptr<MockSessionImpl> sessionMock = std::make_shared<MockSessionImpl>();
uint32_t size = sizeof(dbinder_transaction_data) + SOCKET_MAX_BUFF_SIZE;
dbinder_transaction_data *tmp = (dbinder_transaction_data *)malloc(size);
EXPECT_TRUE(tmp != nullptr);
ASSERT_TRUE(tmp != nullptr);
memset_s(tmp, size, 0, size);
EXPECT_CALL(*sessionMock, GetChannelId())
.WillOnce(testing::Return(0X0000000000FFFFFFULL))
......@@ -843,11 +846,11 @@ HWTEST_F(IPCDbinderDataBusInvokerTest, OnMessageAvailable004, TestSize.Level1)
tmp->magic = DBINDER_MAGICWORD;
testInvoker.OnMessageAvailable(sessionMock, data, len);
EXPECT_FALSE(tmp->cmd == BC_SEND_RAWDATA);
EXPECT_TRUE(tmp->magic == DBINDER_MAGICWORD);
tmp->cmd = BC_SEND_RAWDATA;
testInvoker.OnMessageAvailable(sessionMock, data, len);
EXPECT_FALSE(tmp->sizeOfSelf == static_cast<uint32_t>(len));
EXPECT_TRUE(tmp->cmd == BC_SEND_RAWDATA);
free(tmp);
}
......@@ -862,7 +865,8 @@ HWTEST_F(IPCDbinderDataBusInvokerTest, OnRawDataAvailable001, TestSize.Level1)
std::shared_ptr<MockSessionImpl> sessionMock = std::make_shared<MockSessionImpl>();
uint32_t size = sizeof(dbinder_transaction_data) + SOCKET_MAX_BUFF_SIZE;
dbinder_transaction_data *tmp = (dbinder_transaction_data *)malloc(size);
EXPECT_TRUE(tmp != nullptr);
ASSERT_TRUE(tmp != nullptr);
memset_s(tmp, size, 0, size);
tmp->magic = DBINDER_MAGICWORD;
tmp->cmd = BC_SEND_RAWDATA;
......@@ -894,7 +898,9 @@ HWTEST_F(IPCDbinderDataBusInvokerTest, HasCompletePackage001, TestSize.Level1)
uint32_t readCursor = 0;
dbinder_transaction_data *tmp = (dbinder_transaction_data *)malloc(size);
EXPECT_TRUE(tmp != nullptr);
ASSERT_TRUE(tmp != nullptr);
memset_s(tmp, size, 0, size);
const char *data = reinterpret_cast<const char *>(tmp);
uint32_t res = testInvoker.HasCompletePackage(data, readCursor, size);
EXPECT_EQ(res, readCursor);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册