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

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

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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/public/cpp/test_support/test_support.h » ('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
deleted file mode 100644
index 280d95115deb1c232c471c076f1c651eaaeff649..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/test_support/lib/test_utils.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/public/cpp/test_support/test_utils.h"
-
-#include "mojo/public/cpp/system/handle.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/cpp/system/wait.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, 0u, MOJO_WRITE_MESSAGE_FLAG_NONE);
- return rv == MOJO_RESULT_OK;
-}
-
-bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) {
- MojoResult rv;
- bool did_wait = false;
-
- uint32_t num_bytes = 0u;
- uint32_t num_handles = 0u;
- for (;;) {
- rv = ReadMessageRaw(handle, nullptr, &num_bytes, nullptr, &num_handles,
- MOJO_READ_MESSAGE_FLAG_NONE);
- if (rv == MOJO_RESULT_SHOULD_WAIT) {
- if (did_wait) {
- assert(false); // Looping endlessly!?
- return false;
- }
- rv = Wait(handle, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE,
- nullptr);
- if (rv != MOJO_RESULT_OK)
- return false;
- did_wait = true;
- } else {
- assert(!num_handles);
- break;
- }
- }
-
- text->resize(num_bytes);
- 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,
- MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
- return rv == MOJO_RESULT_OK;
-}
-
-} // namespace test
-} // namespace mojo
« no previous file with comments | « mojo/public/cpp/test_support/BUILD.gn ('k') | mojo/public/cpp/test_support/test_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698