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

Unified Diff: mojo/public/cpp/bindings/tests/synchronous_connector_unittest.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
Index: mojo/public/cpp/bindings/tests/synchronous_connector_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/synchronous_connector_unittest.cc b/mojo/public/cpp/bindings/tests/synchronous_connector_unittest.cc
deleted file mode 100644
index 6aa629004f4578e543c1c209d632370145364172..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/tests/synchronous_connector_unittest.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 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/bindings/lib/synchronous_connector.h"
-
-#include <string.h>
-
-#include <string>
-#include <utility>
-
-#include "gtest/gtest.h"
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/bindings/message.h"
-
-namespace mojo {
-namespace test {
-namespace {
-
-void AllocMessage(const std::string& text, Message* message) {
- size_t payload_size = text.length() + 1; // Plus null terminator.
- MessageBuilder builder(1, payload_size);
- memcpy(builder.buffer()->Allocate(payload_size), text.c_str(), payload_size);
-
- builder.message()->MoveTo(message);
-}
-
-// Simple success case.
-TEST(SynchronousConnectorTest, Basic) {
- MessagePipe pipe;
- internal::SynchronousConnector connector0(std::move(pipe.handle0));
- internal::SynchronousConnector connector1(std::move(pipe.handle1));
-
- const std::string kText("hello world");
- Message message;
- AllocMessage(kText, &message);
-
- EXPECT_TRUE(connector0.Write(&message));
-
- Message message_received;
- EXPECT_TRUE(connector1.BlockingRead(&message_received));
-
- EXPECT_EQ(
- kText,
- std::string(reinterpret_cast<const char*>(message_received.payload())));
-}
-
-// Writing to a closed pipe should fail.
-TEST(SynchronousConnectorTest, WriteToClosedPipe) {
- MessagePipe pipe;
- internal::SynchronousConnector connector0(std::move(pipe.handle0));
-
- // Close the other end of the pipe.
- pipe.handle1.reset();
-
- Message message;
- EXPECT_FALSE(connector0.Write(&message));
-}
-
-// Reading from a closed pipe should fail (while waiting on it).
-TEST(SynchronousConnectorTest, ReadFromClosedPipe) {
- MessagePipe pipe;
- internal::SynchronousConnector connector0(std::move(pipe.handle0));
-
- // Close the other end of the pipe.
- pipe.handle1.reset();
-
- Message message;
- EXPECT_FALSE(connector0.BlockingRead(&message));
-}
-
-} // namespace
-} // namespace test
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698