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

Unified Diff: mojo/public/cpp/test_support/lib/test_utils.cc

Issue 1406013005: Split the //mojo/public/cpp/test_support:test_utils target. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 months 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/public/cpp/test_support/BUILD.gn ('k') | mojo/tests/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/test_support/lib/test_utils.cc
diff --git a/mojo/public/cpp/test_support/lib/test_utils.cc b/mojo/public/cpp/test_support/lib/test_utils.cc
index fc794a86226d2a1f7c5333e97350f74c1ba679f6..15ab8f69cb1cac018017399a4963f140da5ba438 100644
--- a/mojo/public/cpp/test_support/lib/test_utils.cc
+++ b/mojo/public/cpp/test_support/lib/test_utils.cc
@@ -4,20 +4,17 @@
#include "mojo/public/cpp/test_support/test_utils.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/public/cpp/test_support/test_support.h"
+#include "mojo/public/cpp/system/handle.h"
+#include "mojo/public/cpp/system/message_pipe.h"
namespace mojo {
namespace test {
bool WriteTextMessage(const MessagePipeHandle& handle,
const std::string& text) {
- MojoResult rv = WriteMessageRaw(handle,
- text.data(),
- static_cast<uint32_t>(text.size()),
- nullptr,
- 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE);
+ MojoResult rv =
+ WriteMessageRaw(handle, text.data(), static_cast<uint32_t>(text.size()),
+ nullptr, 0u, MOJO_WRITE_MESSAGE_FLAG_NONE);
return rv == MOJO_RESULT_OK;
}
@@ -25,13 +22,10 @@ bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) {
MojoResult rv;
bool did_wait = false;
- uint32_t num_bytes = 0, num_handles = 0;
+ uint32_t num_bytes = 0u;
+ uint32_t num_handles = 0u;
for (;;) {
- rv = ReadMessageRaw(handle,
- nullptr,
- &num_bytes,
- nullptr,
- &num_handles,
+ rv = ReadMessageRaw(handle, nullptr, &num_bytes, nullptr, &num_handles,
MOJO_READ_MESSAGE_FLAG_NONE);
if (rv == MOJO_RESULT_SHOULD_WAIT) {
if (did_wait) {
@@ -50,21 +44,13 @@ bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) {
}
text->resize(num_bytes);
- rv = ReadMessageRaw(handle,
- &text->at(0),
- &num_bytes,
- nullptr,
- &num_handles,
+ rv = ReadMessageRaw(handle, &text->at(0), &num_bytes, nullptr, &num_handles,
MOJO_READ_MESSAGE_FLAG_NONE);
return rv == MOJO_RESULT_OK;
}
bool DiscardMessage(const MessagePipeHandle& handle) {
- MojoResult rv = ReadMessageRaw(handle,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
+ MojoResult rv = ReadMessageRaw(handle, nullptr, nullptr, nullptr, nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
return rv == MOJO_RESULT_OK;
}
« no previous file with comments | « mojo/public/cpp/test_support/BUILD.gn ('k') | mojo/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698