Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: mojo/edk/system/core_unittest.cc

Issue 728553002: Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/system/data_pipe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/core_unittest.cc
diff --git a/mojo/edk/system/core_unittest.cc b/mojo/edk/system/core_unittest.cc
index e6607df0dad95d5f14aadbde5ca52f3cff9aa483..96780f712f92ec81055ba9a189c0054842f0b574 100644
--- a/mojo/edk/system/core_unittest.cc
+++ b/mojo/edk/system/core_unittest.cc
@@ -42,45 +42,34 @@ TEST_F(CoreTest, Basic) {
EXPECT_EQ(0u, info.GetWriteMessageCallCount());
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- NullUserPointer(),
- 0,
+ core()->WriteMessage(h, NullUserPointer(), 0, NullUserPointer(), 0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, info.GetWriteMessageCallCount());
EXPECT_EQ(0u, info.GetReadMessageCallCount());
uint32_t num_bytes = 0;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
- NullUserPointer(),
- NullUserPointer(),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ core()->ReadMessage(h, NullUserPointer(), MakeUserPointer(&num_bytes),
+ NullUserPointer(), NullUserPointer(),
+ MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, info.GetReadMessageCallCount());
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h,
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
+ core()->ReadMessage(h, NullUserPointer(), NullUserPointer(),
+ NullUserPointer(), NullUserPointer(),
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(2u, info.GetReadMessageCallCount());
EXPECT_EQ(0u, info.GetWriteDataCallCount());
- EXPECT_EQ(
- MOJO_RESULT_UNIMPLEMENTED,
- core()->WriteData(
- h, NullUserPointer(), NullUserPointer(), MOJO_WRITE_DATA_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+ core()->WriteData(h, NullUserPointer(), NullUserPointer(),
+ MOJO_WRITE_DATA_FLAG_NONE));
EXPECT_EQ(1u, info.GetWriteDataCallCount());
EXPECT_EQ(0u, info.GetBeginWriteDataCallCount());
- EXPECT_EQ(
- MOJO_RESULT_UNIMPLEMENTED,
- core()->BeginWriteData(
- h, NullUserPointer(), NullUserPointer(), MOJO_WRITE_DATA_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+ core()->BeginWriteData(h, NullUserPointer(), NullUserPointer(),
+ MOJO_WRITE_DATA_FLAG_NONE));
EXPECT_EQ(1u, info.GetBeginWriteDataCallCount());
EXPECT_EQ(0u, info.GetEndWriteDataCallCount());
@@ -88,17 +77,15 @@ TEST_F(CoreTest, Basic) {
EXPECT_EQ(1u, info.GetEndWriteDataCallCount());
EXPECT_EQ(0u, info.GetReadDataCallCount());
- EXPECT_EQ(
- MOJO_RESULT_UNIMPLEMENTED,
- core()->ReadData(
- h, NullUserPointer(), NullUserPointer(), MOJO_READ_DATA_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+ core()->ReadData(h, NullUserPointer(), NullUserPointer(),
+ MOJO_READ_DATA_FLAG_NONE));
EXPECT_EQ(1u, info.GetReadDataCallCount());
EXPECT_EQ(0u, info.GetBeginReadDataCallCount());
- EXPECT_EQ(
- MOJO_RESULT_UNIMPLEMENTED,
- core()->BeginReadData(
- h, NullUserPointer(), NullUserPointer(), MOJO_READ_DATA_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+ core()->BeginReadData(h, NullUserPointer(), NullUserPointer(),
+ MOJO_READ_DATA_FLAG_NONE));
EXPECT_EQ(1u, info.GetBeginReadDataCallCount());
EXPECT_EQ(0u, info.GetEndReadDataCallCount());
@@ -107,9 +94,7 @@ TEST_F(CoreTest, Basic) {
EXPECT_EQ(0u, info.GetAddWaiterCallCount());
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->Wait(h,
- ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE,
+ core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, MOJO_DEADLINE_INDEFINITE,
NullUserPointer()));
EXPECT_EQ(1u, info.GetAddWaiterCallCount());
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
@@ -117,9 +102,7 @@ TEST_F(CoreTest, Basic) {
EXPECT_EQ(2u, info.GetAddWaiterCallCount());
MojoHandleSignalsState hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->Wait(h,
- ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE,
+ core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, MOJO_DEADLINE_INDEFINITE,
MakeUserPointer(&hss)));
EXPECT_EQ(3u, info.GetAddWaiterCallCount());
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -130,51 +113,43 @@ TEST_F(CoreTest, Basic) {
EXPECT_EQ(4u, info.GetAddWaiterCallCount());
hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->Wait(
- h, ~MOJO_HANDLE_SIGNAL_NONE, 10 * 1000, MakeUserPointer(&hss)));
+ core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, 10 * 1000,
+ MakeUserPointer(&hss)));
EXPECT_EQ(5u, info.GetAddWaiterCallCount());
EXPECT_EQ(0u, hss.satisfied_signals);
EXPECT_EQ(0u, hss.satisfiable_signals);
MojoHandleSignals handle_signals = ~MOJO_HANDLE_SIGNAL_NONE;
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(MakeUserPointer(&h),
- MakeUserPointer(&handle_signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ core()->WaitMany(MakeUserPointer(&h), MakeUserPointer(&handle_signals), 1,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()));
EXPECT_EQ(6u, info.GetAddWaiterCallCount());
uint32_t result_index = static_cast<uint32_t>(-1);
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(MakeUserPointer(&h),
- MakeUserPointer(&handle_signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- NullUserPointer()));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ core()->WaitMany(MakeUserPointer(&h), MakeUserPointer(&handle_signals), 1,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ NullUserPointer()));
EXPECT_EQ(7u, info.GetAddWaiterCallCount());
EXPECT_EQ(0u, result_index);
hss = kFullMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(MakeUserPointer(&h),
- MakeUserPointer(&handle_signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- MakeUserPointer(&hss)));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ core()->WaitMany(MakeUserPointer(&h), MakeUserPointer(&handle_signals), 1,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ MakeUserPointer(&hss)));
EXPECT_EQ(8u, info.GetAddWaiterCallCount());
EXPECT_EQ(0u, hss.satisfied_signals);
EXPECT_EQ(0u, hss.satisfiable_signals);
result_index = static_cast<uint32_t>(-1);
hss = kFullMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(MakeUserPointer(&h),
- MakeUserPointer(&handle_signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- MakeUserPointer(&hss)));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ core()->WaitMany(MakeUserPointer(&h), MakeUserPointer(&handle_signals), 1,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ MakeUserPointer(&hss)));
EXPECT_EQ(9u, info.GetAddWaiterCallCount());
EXPECT_EQ(0u, result_index);
EXPECT_EQ(0u, hss.satisfied_signals);
@@ -211,22 +186,16 @@ TEST_F(CoreTest, InvalidArguments) {
// |Wait()|:
{
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->Wait(MOJO_HANDLE_INVALID,
- ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer()));
+ core()->Wait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer()));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->Wait(10,
- ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer()));
+ core()->Wait(10, ~MOJO_HANDLE_SIGNAL_NONE,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer()));
MojoHandleSignalsState hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->Wait(MOJO_HANDLE_INVALID,
- ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&hss)));
+ core()->Wait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&hss)));
// On invalid argument, it shouldn't modify the handle signals state.
EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
hss.satisfied_signals);
@@ -234,10 +203,8 @@ TEST_F(CoreTest, InvalidArguments) {
hss.satisfiable_signals);
hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->Wait(10,
- ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&hss)));
+ core()->Wait(10, ~MOJO_HANDLE_SIGNAL_NONE,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&hss)));
// On invalid argument, it shouldn't modify the handle signals state.
EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
hss.satisfied_signals);
@@ -250,19 +217,14 @@ TEST_F(CoreTest, InvalidArguments) {
MojoHandle handles[2] = {MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID};
MojoHandleSignals signals[2] = {~MOJO_HANDLE_SIGNAL_NONE,
~MOJO_HANDLE_SIGNAL_NONE};
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals), 0,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 0,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()));
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(NullUserPointer(),
- MakeUserPointer(signals),
- 0,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
+ core()->WaitMany(NullUserPointer(), MakeUserPointer(signals), 0,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
NullUserPointer()));
// If |num_handles| is invalid, it should leave |result_index| and
// |signals_states| alone.
@@ -270,9 +232,7 @@ TEST_F(CoreTest, InvalidArguments) {
uint32_t result_index = 123;
MojoHandleSignalsState hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(NullUserPointer(),
- MakeUserPointer(signals),
- 0,
+ core()->WaitMany(NullUserPointer(), MakeUserPointer(signals), 0,
MOJO_DEADLINE_INDEFINITE,
MakeUserPointer(&result_index),
MakeUserPointer(&hss)));
@@ -283,30 +243,23 @@ TEST_F(CoreTest, InvalidArguments) {
hss.satisfiable_signals);
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(MakeUserPointer(handles),
- NullUserPointer(),
- 0,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()));
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
+ core()->WaitMany(MakeUserPointer(handles), NullUserPointer(), 0,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
NullUserPointer()));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals), 1,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()));
// But if a handle is bad, then it should set |result_index| but still leave
// |signals_states| alone.
result_index = static_cast<uint32_t>(-1);
hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- MakeUserPointer(&hss)));
+ core()->WaitMany(
+ MakeUserPointer(handles), MakeUserPointer(signals), 1,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ MakeUserPointer(&hss)));
EXPECT_EQ(0u, result_index);
EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
hss.satisfied_signals);
@@ -319,12 +272,10 @@ TEST_F(CoreTest, InvalidArguments) {
result_index = static_cast<uint32_t>(-1);
hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- MakeUserPointer(&hss)));
+ core()->WaitMany(
+ MakeUserPointer(handles), MakeUserPointer(signals), 1,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ MakeUserPointer(&hss)));
EXPECT_EQ(0u, result_index);
EXPECT_EQ(0u, hss.satisfied_signals);
EXPECT_EQ(0u, hss.satisfiable_signals);
@@ -333,33 +284,27 @@ TEST_F(CoreTest, InvalidArguments) {
result_index = static_cast<uint32_t>(-1);
hss = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 2,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- MakeUserPointer(&hss)));
+ core()->WaitMany(
+ MakeUserPointer(handles), MakeUserPointer(signals), 2,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ MakeUserPointer(&hss)));
EXPECT_EQ(1u, result_index);
EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
hss.satisfied_signals);
EXPECT_EQ(kFullMojoHandleSignalsState.satisfiable_signals,
hss.satisfiable_signals);
handles[1] = handles[0] + 1; // Invalid handle.
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 2,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals), 2,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()));
handles[1] = CreateMockHandle(&info[1]);
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WaitMany(MakeUserPointer(handles),
- MakeUserPointer(signals),
- 2,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ core()->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals), 2,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()));
// TODO(vtl): Test one where we get "failed precondition" only for the
// second handle (and the first one is valid to wait on).
@@ -376,11 +321,8 @@ TEST_F(CoreTest, InvalidArguments) {
// |num_handles|.
{
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WriteMessage(MOJO_HANDLE_INVALID,
- NullUserPointer(),
- 0,
- NullUserPointer(),
- 0,
+ core()->WriteMessage(MOJO_HANDLE_INVALID, NullUserPointer(), 0,
+ NullUserPointer(), 0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
MockHandleInfo info;
@@ -392,55 +334,41 @@ TEST_F(CoreTest, InvalidArguments) {
// Note: This may return either |MOJO_RESULT_INVALID_ARGUMENT| or
// |MOJO_RESULT_RESOURCE_EXHAUSTED|, depending on whether it's plausible or
// not.
- EXPECT_NE(MOJO_RESULT_OK,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- std::numeric_limits<uint32_t>::max(),
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_NE(
+ MOJO_RESULT_OK,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ std::numeric_limits<uint32_t>::max(),
+ MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(0u, info.GetWriteMessageCallCount());
// Huge handle count (plausibly big).
EXPECT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
core()->WriteMessage(
- h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
+ h, NullUserPointer(), 0, MakeUserPointer(handles),
std::numeric_limits<uint32_t>::max() / sizeof(handles[0]),
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(0u, info.GetWriteMessageCallCount());
// Invalid handle in |handles|.
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 1,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 1, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(0u, info.GetWriteMessageCallCount());
// Two invalid handles in |handles|.
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 2,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 2, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(0u, info.GetWriteMessageCallCount());
// Can't send a handle over itself.
handles[0] = h;
- EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 1,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_BUSY,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 1, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(0u, info.GetWriteMessageCallCount());
MockHandleInfo info2;
@@ -448,45 +376,33 @@ TEST_F(CoreTest, InvalidArguments) {
// This is "okay", but |MockDispatcher| doesn't implement it.
handles[0] = h2;
- EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 1,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_UNIMPLEMENTED,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 1, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, info.GetWriteMessageCallCount());
// One of the |handles| is still invalid.
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 2,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 2, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, info.GetWriteMessageCallCount());
// One of the |handles| is the same as |handle|.
handles[1] = h;
- EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 2,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_BUSY,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 2, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, info.GetWriteMessageCallCount());
// Can't send a handle twice in the same message.
handles[1] = h2;
- EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- MakeUserPointer(handles),
- 2,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_BUSY,
+ core()->WriteMessage(h, NullUserPointer(), 0, MakeUserPointer(handles),
+ 2, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, info.GetWriteMessageCallCount());
// Note: Since we never successfully sent anything with it, |h2| should
@@ -500,13 +416,11 @@ TEST_F(CoreTest, InvalidArguments) {
// Only check arguments checked by |Core|, namely |handle|, |handles|, and
// |num_handles|.
{
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->ReadMessage(MOJO_HANDLE_INVALID,
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->ReadMessage(MOJO_HANDLE_INVALID, NullUserPointer(),
+ NullUserPointer(), NullUserPointer(),
+ NullUserPointer(), MOJO_READ_MESSAGE_FLAG_NONE));
MockHandleInfo info;
MojoHandle h = CreateMockHandle(&info);
@@ -514,12 +428,9 @@ TEST_F(CoreTest, InvalidArguments) {
// Okay.
uint32_t handle_count = 0;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h,
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
- MakeUserPointer(&handle_count),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h, NullUserPointer(), NullUserPointer(), NullUserPointer(),
+ MakeUserPointer(&handle_count), MOJO_READ_MESSAGE_FLAG_NONE));
// Checked by |Core|, shouldn't go through to the dispatcher.
EXPECT_EQ(1u, info.GetReadMessageCallCount());
@@ -540,20 +451,16 @@ TEST_F(CoreTest, InvalidArgumentsDeath) {
{
MojoHandle handle = MOJO_HANDLE_INVALID;
MojoHandleSignals signals = ~MOJO_HANDLE_SIGNAL_NONE;
- EXPECT_DEATH_IF_SUPPORTED(core()->WaitMany(NullUserPointer(),
- MakeUserPointer(&signals),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()),
- kMemoryCheckFailedRegex);
- EXPECT_DEATH_IF_SUPPORTED(core()->WaitMany(MakeUserPointer(&handle),
- NullUserPointer(),
- 1,
- MOJO_DEADLINE_INDEFINITE,
- NullUserPointer(),
- NullUserPointer()),
- kMemoryCheckFailedRegex);
+ EXPECT_DEATH_IF_SUPPORTED(
+ core()->WaitMany(NullUserPointer(), MakeUserPointer(&signals), 1,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()),
+ kMemoryCheckFailedRegex);
+ EXPECT_DEATH_IF_SUPPORTED(
+ core()->WaitMany(MakeUserPointer(&handle), NullUserPointer(), 1,
+ MOJO_DEADLINE_INDEFINITE, NullUserPointer(),
+ NullUserPointer()),
+ kMemoryCheckFailedRegex);
// TODO(vtl): |result_index| and |signals_states| are optional. Test them
// with non-null invalid pointers?
}
@@ -562,16 +469,16 @@ TEST_F(CoreTest, InvalidArgumentsDeath) {
{
MojoHandle h;
EXPECT_DEATH_IF_SUPPORTED(
- core()->CreateMessagePipe(
- NullUserPointer(), NullUserPointer(), NullUserPointer()),
+ core()->CreateMessagePipe(NullUserPointer(), NullUserPointer(),
+ NullUserPointer()),
kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(
- core()->CreateMessagePipe(
- NullUserPointer(), MakeUserPointer(&h), NullUserPointer()),
+ core()->CreateMessagePipe(NullUserPointer(), MakeUserPointer(&h),
+ NullUserPointer()),
kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(
- core()->CreateMessagePipe(
- NullUserPointer(), NullUserPointer(), MakeUserPointer(&h)),
+ core()->CreateMessagePipe(NullUserPointer(), NullUserPointer(),
+ MakeUserPointer(&h)),
kMemoryCheckFailedRegex);
}
@@ -584,11 +491,7 @@ TEST_F(CoreTest, InvalidArgumentsDeath) {
// Null |handles| with nonzero |num_handles|.
EXPECT_DEATH_IF_SUPPORTED(
- core()->WriteMessage(h,
- NullUserPointer(),
- 0,
- NullUserPointer(),
- 1,
+ core()->WriteMessage(h, NullUserPointer(), 0, NullUserPointer(), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE),
kMemoryCheckFailedRegex);
@@ -604,11 +507,8 @@ TEST_F(CoreTest, InvalidArgumentsDeath) {
uint32_t handle_count = 1;
EXPECT_DEATH_IF_SUPPORTED(
- core()->ReadMessage(h,
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
- MakeUserPointer(&handle_count),
+ core()->ReadMessage(h, NullUserPointer(), NullUserPointer(),
+ NullUserPointer(), MakeUserPointer(&handle_count),
MOJO_READ_MESSAGE_FLAG_NONE),
kMemoryCheckFailedRegex);
@@ -625,10 +525,9 @@ TEST_F(CoreTest, MessagePipe) {
MojoHandleSignalsState hss[2];
uint32_t result_index;
- EXPECT_EQ(
- MOJO_RESULT_OK,
- core()->CreateMessagePipe(
- NullUserPointer(), MakeUserPointer(&h[0]), MakeUserPointer(&h[1])));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ core()->CreateMessagePipe(NullUserPointer(), MakeUserPointer(&h[0]),
+ MakeUserPointer(&h[1])));
// Should get two distinct, valid handles.
EXPECT_NE(h[0], MOJO_HANDLE_INVALID);
EXPECT_NE(h[1], MOJO_HANDLE_INVALID);
@@ -640,13 +539,10 @@ TEST_F(CoreTest, MessagePipe) {
result_index = static_cast<uint32_t>(-1);
hss[0] = kEmptyMojoHandleSignalsState;
hss[1] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
- core()->WaitMany(MakeUserPointer(h),
- MakeUserPointer(signals),
- 2,
- 0,
- MakeUserPointer(&result_index),
- MakeUserPointer(hss)));
+ EXPECT_EQ(
+ MOJO_RESULT_DEADLINE_EXCEEDED,
+ core()->WaitMany(MakeUserPointer(h), MakeUserPointer(signals), 2, 0,
+ MakeUserPointer(&result_index), MakeUserPointer(hss)));
EXPECT_EQ(static_cast<uint32_t>(-1), result_index);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
@@ -658,33 +554,25 @@ TEST_F(CoreTest, MessagePipe) {
// Try to read anyway.
char buffer[1] = {'a'};
uint32_t buffer_size = 1;
- EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
- core()->ReadMessage(h[0],
- UserPointer<void>(buffer),
- MakeUserPointer(&buffer_size),
- NullUserPointer(),
- NullUserPointer(),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_SHOULD_WAIT,
+ core()->ReadMessage(h[0], UserPointer<void>(buffer),
+ MakeUserPointer(&buffer_size), NullUserPointer(),
+ NullUserPointer(), MOJO_READ_MESSAGE_FLAG_NONE));
// Check that it left its inputs alone.
EXPECT_EQ('a', buffer[0]);
EXPECT_EQ(1u, buffer_size);
// Both should be writable.
hss[0] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h[0],
- MOJO_HANDLE_SIGNAL_WRITABLE,
- 1000000000,
- MakeUserPointer(&hss[0])));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(h[0], MOJO_HANDLE_SIGNAL_WRITABLE,
+ 1000000000, MakeUserPointer(&hss[0])));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss[0].satisfiable_signals);
hss[0] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h[1],
- MOJO_HANDLE_SIGNAL_WRITABLE,
- 1000000000,
- MakeUserPointer(&hss[0])));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(h[1], MOJO_HANDLE_SIGNAL_WRITABLE,
+ 1000000000, MakeUserPointer(&hss[0])));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss[0].satisfiable_signals);
@@ -695,13 +583,11 @@ TEST_F(CoreTest, MessagePipe) {
result_index = static_cast<uint32_t>(-1);
hss[0] = kEmptyMojoHandleSignalsState;
hss[1] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->WaitMany(MakeUserPointer(h),
- MakeUserPointer(signals),
- 2,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- MakeUserPointer(hss)));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ core()->WaitMany(MakeUserPointer(h), MakeUserPointer(signals), 2,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ MakeUserPointer(hss)));
EXPECT_EQ(1u, result_index);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
@@ -712,13 +598,10 @@ TEST_F(CoreTest, MessagePipe) {
// Write to |h[1]|.
buffer[0] = 'b';
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h[1],
- UserPointer<const void>(buffer),
- 1,
- NullUserPointer(),
- 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ core()->WriteMessage(h[1], UserPointer<const void>(buffer), 1,
+ NullUserPointer(), 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
// Check that |h[0]| is now readable.
signals[0] = MOJO_HANDLE_SIGNAL_READABLE;
@@ -726,13 +609,11 @@ TEST_F(CoreTest, MessagePipe) {
result_index = static_cast<uint32_t>(-1);
hss[0] = kEmptyMojoHandleSignalsState;
hss[1] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->WaitMany(MakeUserPointer(h),
- MakeUserPointer(signals),
- 2,
- MOJO_DEADLINE_INDEFINITE,
- MakeUserPointer(&result_index),
- MakeUserPointer(hss)));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ core()->WaitMany(MakeUserPointer(h), MakeUserPointer(signals), 2,
+ MOJO_DEADLINE_INDEFINITE, MakeUserPointer(&result_index),
+ MakeUserPointer(hss)));
EXPECT_EQ(0u, result_index);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss[0].satisfied_signals);
@@ -745,46 +626,38 @@ TEST_F(CoreTest, MessagePipe) {
// Read from |h[0]|.
// First, get only the size.
buffer_size = 0;
- EXPECT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
- core()->ReadMessage(h[0],
- NullUserPointer(),
- MakeUserPointer(&buffer_size),
- NullUserPointer(),
- NullUserPointer(),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_RESOURCE_EXHAUSTED,
+ core()->ReadMessage(h[0], NullUserPointer(),
+ MakeUserPointer(&buffer_size), NullUserPointer(),
+ NullUserPointer(), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(1u, buffer_size);
// Then actually read it.
buffer[0] = 'c';
buffer_size = 1;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h[0],
- UserPointer<void>(buffer),
- MakeUserPointer(&buffer_size),
- NullUserPointer(),
- NullUserPointer(),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ core()->ReadMessage(h[0], UserPointer<void>(buffer),
+ MakeUserPointer(&buffer_size), NullUserPointer(),
+ NullUserPointer(), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ('b', buffer[0]);
EXPECT_EQ(1u, buffer_size);
// |h[0]| should no longer be readable.
hss[0] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(
- MOJO_RESULT_DEADLINE_EXCEEDED,
- core()->Wait(
- h[0], MOJO_HANDLE_SIGNAL_READABLE, 0, MakeUserPointer(&hss[0])));
+ EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+ core()->Wait(h[0], MOJO_HANDLE_SIGNAL_READABLE, 0,
+ MakeUserPointer(&hss[0])));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss[0].satisfiable_signals);
// Write to |h[0]|.
buffer[0] = 'd';
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h[0],
- UserPointer<const void>(buffer),
- 1,
- NullUserPointer(),
- 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ core()->WriteMessage(h[0], UserPointer<const void>(buffer), 1,
+ NullUserPointer(), 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
// Close |h[0]|.
EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h[0]));
@@ -792,51 +665,38 @@ TEST_F(CoreTest, MessagePipe) {
// Check that |h[1]| is no longer writable (and will never be).
hss[0] = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->Wait(h[1],
- MOJO_HANDLE_SIGNAL_WRITABLE,
- 1000000000,
+ core()->Wait(h[1], MOJO_HANDLE_SIGNAL_WRITABLE, 1000000000,
MakeUserPointer(&hss[0])));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss[0].satisfiable_signals);
// Check that |h[1]| is still readable (for the moment).
hss[0] = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
- MakeUserPointer(&hss[0])));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(h[1], MOJO_HANDLE_SIGNAL_READABLE,
+ 1000000000, MakeUserPointer(&hss[0])));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss[0].satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss[0].satisfiable_signals);
// Discard a message from |h[1]|.
EXPECT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
- core()->ReadMessage(h[1],
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
- NullUserPointer(),
+ core()->ReadMessage(h[1], NullUserPointer(), NullUserPointer(),
+ NullUserPointer(), NullUserPointer(),
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
// |h[1]| is no longer readable (and will never be).
hss[0] = kFullMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->Wait(h[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss[0])));
EXPECT_EQ(0u, hss[0].satisfied_signals);
EXPECT_EQ(0u, hss[0].satisfiable_signals);
// Try writing to |h[1]|.
buffer[0] = 'e';
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- core()->WriteMessage(h[1],
- UserPointer<const void>(buffer),
- 1,
- NullUserPointer(),
- 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ core()->WriteMessage(h[1], UserPointer<const void>(buffer), 1,
+ NullUserPointer(), 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h[1]));
}
@@ -863,17 +723,12 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
// Make sure that |h_passing[]| work properly.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- NullUserPointer(),
- 0,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, NullUserPointer(), 0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passing[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -882,12 +737,10 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passing[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passing[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, num_bytes);
EXPECT_STREQ(kHello, buffer);
EXPECT_EQ(0u, num_handles);
@@ -895,18 +748,12 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
// Make sure that you can't pass either of the message pipe's handles over
// itself.
EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- MakeUserPointer(&h_passing[0]),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, MakeUserPointer(&h_passing[0]), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- MakeUserPointer(&h_passing[1]),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, MakeUserPointer(&h_passing[1]), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
MojoHandle h_passed[2];
@@ -917,17 +764,12 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
// Make sure that |h_passed[]| work properly.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passed[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- NullUserPointer(),
- 0,
+ core()->WriteMessage(h_passed[0], UserPointer<const void>(kHello),
+ kHelloSize, NullUserPointer(), 0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passed[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passed[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -936,29 +778,22 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passed[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passed[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, num_bytes);
EXPECT_STREQ(kHello, buffer);
EXPECT_EQ(0u, num_handles);
// Send |h_passed[1]| from |h_passing[0]| to |h_passing[1]|.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kWorld),
- kWorldSize,
- MakeUserPointer(&h_passed[1]),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kWorld),
+ kWorldSize, MakeUserPointer(&h_passed[1]), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passing[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -967,12 +802,10 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passing[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passing[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kWorldSize, num_bytes);
EXPECT_STREQ(kWorld, buffer);
EXPECT_EQ(1u, num_handles);
@@ -991,17 +824,12 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
// Write to |h_passed[0]|. Should receive on |h_received|.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passed[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- NullUserPointer(),
- 0,
+ core()->WriteMessage(h_passed[0], UserPointer<const void>(kHello),
+ kHelloSize, NullUserPointer(), 0,
MOJO_WRITE_MESSAGE_FLAG_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_received,
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_received, MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -1010,12 +838,10 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_received,
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_received, UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, num_bytes);
EXPECT_STREQ(kHello, buffer);
EXPECT_EQ(0u, num_handles);
@@ -1031,8 +857,8 @@ TEST_F(CoreTest, DataPipe) {
MojoHandleSignalsState hss;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->CreateDataPipe(
- NullUserPointer(), MakeUserPointer(&ph), MakeUserPointer(&ch)));
+ core()->CreateDataPipe(NullUserPointer(), MakeUserPointer(&ph),
+ MakeUserPointer(&ch)));
// Should get two distinct, valid handles.
EXPECT_NE(ph, MOJO_HANDLE_INVALID);
EXPECT_NE(ch, MOJO_HANDLE_INVALID);
@@ -1046,9 +872,8 @@ TEST_F(CoreTest, DataPipe) {
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfiable_signals);
hss = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(
- MOJO_RESULT_OK,
- core()->Wait(ph, MOJO_HANDLE_SIGNAL_WRITABLE, 0, MakeUserPointer(&hss)));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(ph, MOJO_HANDLE_SIGNAL_WRITABLE, 0,
+ MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfiable_signals);
@@ -1070,17 +895,15 @@ TEST_F(CoreTest, DataPipe) {
char elements[2] = {'A', 'B'};
uint32_t num_bytes = 2u;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteData(ph,
- UserPointer<const void>(elements),
+ core()->WriteData(ph, UserPointer<const void>(elements),
MakeUserPointer(&num_bytes),
MOJO_WRITE_DATA_FLAG_NONE));
EXPECT_EQ(2u, num_bytes);
// Consumer should now be readable.
hss = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(
- MOJO_RESULT_OK,
- core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 0, MakeUserPointer(&hss)));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 0,
+ MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
@@ -1090,9 +913,7 @@ TEST_F(CoreTest, DataPipe) {
num_bytes = 1u;
EXPECT_EQ(MOJO_RESULT_OK,
core()->ReadData(
- ch,
- UserPointer<void>(elements),
- MakeUserPointer(&num_bytes),
+ ch, UserPointer<void>(elements), MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_NONE | MOJO_READ_DATA_FLAG_PEEK));
EXPECT_EQ('A', elements[0]);
EXPECT_EQ(-1, elements[1]);
@@ -1101,11 +922,9 @@ TEST_F(CoreTest, DataPipe) {
elements[0] = -1;
elements[1] = -1;
num_bytes = 1u;
- EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadData(ch,
- UserPointer<void>(elements),
- MakeUserPointer(&num_bytes),
- MOJO_READ_DATA_FLAG_NONE));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->ReadData(ch, UserPointer<void>(elements),
+ MakeUserPointer(&num_bytes),
+ MOJO_READ_DATA_FLAG_NONE));
EXPECT_EQ('A', elements[0]);
EXPECT_EQ(-1, elements[1]);
@@ -1113,8 +932,7 @@ TEST_F(CoreTest, DataPipe) {
void* write_ptr = nullptr;
num_bytes = 0u;
ASSERT_EQ(MOJO_RESULT_OK,
- core()->BeginWriteData(ph,
- MakeUserPointer(&write_ptr),
+ core()->BeginWriteData(ph, MakeUserPointer(&write_ptr),
MakeUserPointer(&num_bytes),
MOJO_WRITE_DATA_FLAG_NONE));
// We count on the default options providing a decent buffer size.
@@ -1124,8 +942,7 @@ TEST_F(CoreTest, DataPipe) {
elements[0] = 'X';
num_bytes = 1u;
EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteData(ph,
- UserPointer<const void>(elements),
+ core()->WriteData(ph, UserPointer<const void>(elements),
MakeUserPointer(&num_bytes),
MOJO_WRITE_DATA_FLAG_NONE));
@@ -1138,63 +955,51 @@ TEST_F(CoreTest, DataPipe) {
// Query how much data we have.
num_bytes = 0;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadData(ch,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
+ core()->ReadData(ch, NullUserPointer(), MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_QUERY));
EXPECT_EQ(4u, num_bytes);
// Try to query with peek. Should fail.
num_bytes = 0;
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->ReadData(
- ch,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
- MOJO_READ_DATA_FLAG_QUERY | MOJO_READ_DATA_FLAG_PEEK));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->ReadData(ch, NullUserPointer(), MakeUserPointer(&num_bytes),
+ MOJO_READ_DATA_FLAG_QUERY | MOJO_READ_DATA_FLAG_PEEK));
EXPECT_EQ(0u, num_bytes);
// Try to discard ten characters, in all-or-none mode. Should fail.
num_bytes = 10;
EXPECT_EQ(MOJO_RESULT_OUT_OF_RANGE,
core()->ReadData(
- ch,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
+ ch, NullUserPointer(), MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_ALL_OR_NONE));
// Try to discard two characters, in peek mode. Should fail.
num_bytes = 2;
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->ReadData(
- ch,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
- MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_PEEK));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ core()->ReadData(ch, NullUserPointer(), MakeUserPointer(&num_bytes),
+ MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_PEEK));
// Discard two characters.
num_bytes = 2;
EXPECT_EQ(MOJO_RESULT_OK,
core()->ReadData(
- ch,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
+ ch, NullUserPointer(), MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_ALL_OR_NONE));
// Try a two-phase read of the remaining two bytes with peek. Should fail.
const void* read_ptr = nullptr;
num_bytes = 2;
ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- core()->BeginReadData(ch,
- MakeUserPointer(&read_ptr),
+ core()->BeginReadData(ch, MakeUserPointer(&read_ptr),
MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_PEEK));
// Read the remaining two characters, in two-phase mode (all-or-none).
num_bytes = 2;
ASSERT_EQ(MOJO_RESULT_OK,
- core()->BeginReadData(ch,
- MakeUserPointer(&read_ptr),
+ core()->BeginReadData(ch, MakeUserPointer(&read_ptr),
MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_ALL_OR_NONE));
// Note: Count on still being able to do the contiguous read here.
@@ -1203,9 +1008,7 @@ TEST_F(CoreTest, DataPipe) {
// Discarding right now should fail.
num_bytes = 1;
EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->ReadData(ch,
- NullUserPointer(),
- MakeUserPointer(&num_bytes),
+ core()->ReadData(ch, NullUserPointer(), MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_DISCARD));
// Actually check our data and end the two-phase read.
@@ -1258,22 +1061,17 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
MojoHandle ph, ch;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->CreateDataPipe(
- NullUserPointer(), MakeUserPointer(&ph), MakeUserPointer(&ch)));
+ core()->CreateDataPipe(NullUserPointer(), MakeUserPointer(&ph),
+ MakeUserPointer(&ch)));
// Send |ch| from |h_passing[0]| to |h_passing[1]|.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- MakeUserPointer(&ch),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, MakeUserPointer(&ch), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passing[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -1282,12 +1080,10 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passing[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passing[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, num_bytes);
EXPECT_STREQ(kHello, buffer);
EXPECT_EQ(1u, num_handles);
@@ -1307,22 +1103,18 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
// Write to |ph|. Should receive on |ch_received|.
num_bytes = kWorldSize;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteData(ph,
- UserPointer<const void>(kWorld),
+ core()->WriteData(ph, UserPointer<const void>(kWorld),
MakeUserPointer(&num_bytes),
MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(ch_received,
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(ch_received, MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
num_bytes = kBufferSize;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadData(ch_received,
- UserPointer<void>(buffer),
+ core()->ReadData(ch_received, UserPointer<void>(buffer),
MakeUserPointer(&num_bytes),
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kWorldSize, num_bytes);
@@ -1330,17 +1122,12 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
// Now pass |ph| in the same direction.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kWorld),
- kWorldSize,
- MakeUserPointer(&ph),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kWorld),
+ kWorldSize, MakeUserPointer(&ph), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passing[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -1349,12 +1136,10 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passing[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passing[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kWorldSize, num_bytes);
EXPECT_STREQ(kWorld, buffer);
EXPECT_EQ(1u, num_handles);
@@ -1374,22 +1159,18 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
// Write to |ph_received|. Should receive on |ch_received|.
num_bytes = kHelloSize;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteData(ph_received,
- UserPointer<const void>(kHello),
+ core()->WriteData(ph_received, UserPointer<const void>(kHello),
MakeUserPointer(&num_bytes),
MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(ch_received,
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(ch_received, MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
num_bytes = kBufferSize;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadData(ch_received,
- UserPointer<void>(buffer),
+ core()->ReadData(ch_received, UserPointer<void>(buffer),
MakeUserPointer(&num_bytes),
MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, num_bytes);
@@ -1404,42 +1185,31 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
void* write_ptr = nullptr;
num_bytes = 0;
ASSERT_EQ(MOJO_RESULT_OK,
- core()->BeginWriteData(ph,
- MakeUserPointer(&write_ptr),
+ core()->BeginWriteData(ph, MakeUserPointer(&write_ptr),
MakeUserPointer(&num_bytes),
MOJO_WRITE_DATA_FLAG_NONE));
ASSERT_GE(num_bytes, 1u);
EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- MakeUserPointer(&ph),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, MakeUserPointer(&ph), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// But |ch| can, even if |ph| is in a two-phase write.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- MakeUserPointer(&ch),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, MakeUserPointer(&ch), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
ch = MOJO_HANDLE_INVALID;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passing[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
NullUserPointer()));
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passing[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passing[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, num_bytes);
EXPECT_STREQ(kHello, buffer);
EXPECT_EQ(1u, num_handles);
@@ -1452,10 +1222,8 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
// Wait for |ch| to be readable.
hss = kEmptyMojoHandleSignalsState;
- EXPECT_EQ(
- MOJO_RESULT_OK,
- core()->Wait(
- ch, MOJO_HANDLE_SIGNAL_READABLE, 1000000000, MakeUserPointer(&hss)));
+ EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE,
+ 1000000000, MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
@@ -1463,32 +1231,23 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
const void* read_ptr = nullptr;
num_bytes = 1;
ASSERT_EQ(MOJO_RESULT_OK,
- core()->BeginReadData(ch,
- MakeUserPointer(&read_ptr),
+ core()->BeginReadData(ch, MakeUserPointer(&read_ptr),
MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_ALL_OR_NONE));
EXPECT_EQ(MOJO_RESULT_BUSY,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kHello),
- kHelloSize,
- MakeUserPointer(&ch),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
+ kHelloSize, MakeUserPointer(&ch), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
// But |ph| can, even if |ch| is in a two-phase read.
EXPECT_EQ(MOJO_RESULT_OK,
- core()->WriteMessage(h_passing[0],
- UserPointer<const void>(kWorld),
- kWorldSize,
- MakeUserPointer(&ph),
- 1,
+ core()->WriteMessage(h_passing[0], UserPointer<const void>(kWorld),
+ kWorldSize, MakeUserPointer(&ph), 1,
MOJO_WRITE_MESSAGE_FLAG_NONE));
ph = MOJO_HANDLE_INVALID;
hss = kEmptyMojoHandleSignalsState;
EXPECT_EQ(MOJO_RESULT_OK,
- core()->Wait(h_passing[1],
- MOJO_HANDLE_SIGNAL_READABLE,
- 1000000000,
+ core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
MakeUserPointer(&hss)));
EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
hss.satisfied_signals);
@@ -1497,12 +1256,10 @@ TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
num_bytes = kBufferSize;
num_handles = arraysize(handles);
EXPECT_EQ(MOJO_RESULT_OK,
- core()->ReadMessage(h_passing[1],
- UserPointer<void>(buffer),
- MakeUserPointer(&num_bytes),
- MakeUserPointer(handles),
- MakeUserPointer(&num_handles),
- MOJO_READ_MESSAGE_FLAG_NONE));
+ core()->ReadMessage(
+ h_passing[1], UserPointer<void>(buffer),
+ MakeUserPointer(&num_bytes), MakeUserPointer(handles),
+ MakeUserPointer(&num_handles), MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kWorldSize, num_bytes);
EXPECT_STREQ(kWorld, buffer);
EXPECT_EQ(1u, num_handles);
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/system/data_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698