|
|
|
@ -47,8 +47,8 @@ TEST_P(FakeBinderTest, SendInt32) { |
|
|
|
|
int called = 0; |
|
|
|
|
std::unique_ptr<Binder> sender; |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
std::tie(sender, tx_receiver) = |
|
|
|
|
NewBinderPair([&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
std::tie(sender, tx_receiver) = NewBinderPair( |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
EXPECT_EQ(tx_code, kTxCode); |
|
|
|
|
int value = 0; |
|
|
|
|
EXPECT_TRUE(parcel->ReadInt32(&value).ok()); |
|
|
|
@ -72,8 +72,8 @@ TEST_P(FakeBinderTest, SendString) { |
|
|
|
|
int called = 0; |
|
|
|
|
std::unique_ptr<Binder> sender; |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
std::tie(sender, tx_receiver) = |
|
|
|
|
NewBinderPair([&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
std::tie(sender, tx_receiver) = NewBinderPair( |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
EXPECT_EQ(tx_code, kTxCode); |
|
|
|
|
std::string value; |
|
|
|
|
EXPECT_TRUE(parcel->ReadString(&value).ok()); |
|
|
|
@ -97,8 +97,8 @@ TEST_P(FakeBinderTest, SendByteArray) { |
|
|
|
|
int called = 0; |
|
|
|
|
std::unique_ptr<Binder> sender; |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
std::tie(sender, tx_receiver) = |
|
|
|
|
NewBinderPair([&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
std::tie(sender, tx_receiver) = NewBinderPair( |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
EXPECT_EQ(tx_code, kTxCode); |
|
|
|
|
std::string value; |
|
|
|
|
EXPECT_TRUE(parcel->ReadByteArray(&value).ok()); |
|
|
|
@ -127,8 +127,8 @@ TEST_P(FakeBinderTest, SendMultipleItems) { |
|
|
|
|
int called = 0; |
|
|
|
|
std::unique_ptr<Binder> sender; |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
std::tie(sender, tx_receiver) = |
|
|
|
|
NewBinderPair([&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
std::tie(sender, tx_receiver) = NewBinderPair( |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
int value_result; |
|
|
|
|
EXPECT_EQ(tx_code, kTxCode); |
|
|
|
|
EXPECT_TRUE(parcel->ReadInt32(&value_result).ok()); |
|
|
|
@ -163,8 +163,8 @@ TEST_P(FakeBinderTest, SendBinder) { |
|
|
|
|
int called = 0; |
|
|
|
|
std::unique_ptr<Binder> sender; |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
std::tie(sender, tx_receiver) = |
|
|
|
|
NewBinderPair([&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
std::tie(sender, tx_receiver) = NewBinderPair( |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
EXPECT_EQ(tx_code, kTxCode); |
|
|
|
|
std::unique_ptr<Binder> binder; |
|
|
|
|
EXPECT_TRUE(parcel->ReadBinder(&binder).ok()); |
|
|
|
@ -179,7 +179,8 @@ TEST_P(FakeBinderTest, SendBinder) { |
|
|
|
|
int called2 = 0; |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver2 = |
|
|
|
|
absl::make_unique<FakeTransactionReceiver>( |
|
|
|
|
nullptr, [&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
nullptr, |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
int value; |
|
|
|
|
EXPECT_TRUE(parcel->ReadInt32(&value).ok()); |
|
|
|
|
EXPECT_EQ(value, kValue); |
|
|
|
@ -204,8 +205,8 @@ TEST_P(FakeBinderTest, SendTransactionAfterDestruction) { |
|
|
|
|
int called = 0; |
|
|
|
|
{ |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
std::tie(sender, tx_receiver) = |
|
|
|
|
NewBinderPair([&](transaction_code_t tx_code, ReadableParcel* parcel) { |
|
|
|
|
std::tie(sender, tx_receiver) = NewBinderPair( |
|
|
|
|
[&](transaction_code_t tx_code, ReadableParcel* parcel, int /*uid*/) { |
|
|
|
|
EXPECT_EQ(tx_code, kTxCode); |
|
|
|
|
int value; |
|
|
|
|
EXPECT_TRUE(parcel->ReadInt32(&value).ok()); |
|
|
|
@ -275,9 +276,10 @@ TEST_P(FakeBinderTest, StressTest) { |
|
|
|
|
std::unique_ptr<TransactionReceiver> tx_receiver; |
|
|
|
|
int expected_tx_code = th_arg->tx_code; |
|
|
|
|
std::vector<std::vector<int>>* cnt = th_arg->global_cnts; |
|
|
|
|
std::tie(binder, tx_receiver) = NewBinderPair( |
|
|
|
|
[tid, p, cnt, expected_tx_code](transaction_code_t tx_code, |
|
|
|
|
ReadableParcel* parcel) mutable { |
|
|
|
|
std::tie(binder, tx_receiver) = |
|
|
|
|
NewBinderPair([tid, p, cnt, expected_tx_code]( |
|
|
|
|
transaction_code_t tx_code, ReadableParcel* parcel, |
|
|
|
|
int /*uid*/) mutable { |
|
|
|
|
EXPECT_EQ(tx_code, expected_tx_code); |
|
|
|
|
int value; |
|
|
|
|
EXPECT_TRUE(parcel->ReadInt32(&value).ok()); |
|
|
|
|