mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Changes to comms_test module to run unittests with --config=android_arm64
PiperOrigin-RevId: 438017732 Change-Id: I10a8ec154793f57f194a265e590f39b36c3d3043
This commit is contained in:
parent
dc895f6dc8
commit
c1ac5c3833
|
@ -76,7 +76,7 @@ class CommsTest : public ::testing::Test {
|
||||||
int fd_server_;
|
int fd_server_;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr char kProtoStr[] = "value: \"ABCD\"\n";
|
constexpr char kProtoStr[] = "ABCD";
|
||||||
static const absl::string_view NullTestString() {
|
static const absl::string_view NullTestString() {
|
||||||
static constexpr char kHelperStr[] = "test\0\n\r\t\x01\x02";
|
static constexpr char kHelperStr[] = "test\0\n\r\t\x01\x02";
|
||||||
return absl::string_view(kHelperStr, sizeof(kHelperStr) - 1);
|
return absl::string_view(kHelperStr, sizeof(kHelperStr) - 1);
|
||||||
|
@ -285,16 +285,14 @@ TEST_F(CommsTest, TestSendRecvProto) {
|
||||||
// Receive a ProtoBuf.
|
// Receive a ProtoBuf.
|
||||||
std::unique_ptr<CommsTestMsg> comms_msg(new CommsTestMsg());
|
std::unique_ptr<CommsTestMsg> comms_msg(new CommsTestMsg());
|
||||||
ASSERT_THAT(comms->RecvProtoBuf(comms_msg.get()), IsTrue());
|
ASSERT_THAT(comms->RecvProtoBuf(comms_msg.get()), IsTrue());
|
||||||
std::string tmp_str;
|
ASSERT_THAT(comms_msg->value_size(), Eq(1));
|
||||||
ASSERT_THAT(google::protobuf::TextFormat::PrintToString(*comms_msg, &tmp_str),
|
EXPECT_THAT(comms_msg->value(0), Eq(kProtoStr));
|
||||||
IsTrue());
|
|
||||||
EXPECT_THAT(tmp_str, Eq(kProtoStr));
|
|
||||||
};
|
};
|
||||||
auto b = [](Comms* comms) {
|
auto b = [](Comms* comms) {
|
||||||
// Send a ProtoBuf.
|
// Send a ProtoBuf.
|
||||||
std::unique_ptr<CommsTestMsg> comms_msg(new CommsTestMsg());
|
std::unique_ptr<CommsTestMsg> comms_msg(new CommsTestMsg());
|
||||||
ASSERT_THAT(google::protobuf::TextFormat::ParseFromString(kProtoStr, comms_msg.get()),
|
comms_msg->add_value(kProtoStr);
|
||||||
IsTrue());
|
ASSERT_THAT(comms_msg->value_size(), Eq(1));
|
||||||
ASSERT_THAT(comms->SendProtoBuf(*comms_msg), IsTrue());
|
ASSERT_THAT(comms->SendProtoBuf(*comms_msg), IsTrue());
|
||||||
};
|
};
|
||||||
HandleCommunication(sockname_, a, b);
|
HandleCommunication(sockname_, a, b);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user