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

Unified Diff: mojo/public/cpp/bindings/tests/message_builder_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
« no previous file with comments | « mojo/public/cpp/bindings/tests/map_unittest.cc ('k') | mojo/public/cpp/bindings/tests/message_queue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/message_builder_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/message_builder_unittest.cc b/mojo/public/cpp/bindings/tests/message_builder_unittest.cc
deleted file mode 100644
index 14c090201260f65ba63f5f50fc290f40664d66da..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/tests/message_builder_unittest.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2015 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 "gtest/gtest.h"
-#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "mojo/public/cpp/bindings/lib/message_builder.h"
-#include "mojo/public/cpp/bindings/lib/message_internal.h"
-
-namespace mojo {
-namespace test {
-namespace {
-
-TEST(MessageBuilderTest, MessageBuilder) {
- char payload[41];
- MessageBuilder b(123u, sizeof(payload));
-
- // The payload size should be a multiple of 8.
- EXPECT_EQ(48u, b.message()->payload_num_bytes());
-
- // payload size + message header size:
- EXPECT_EQ(48u + sizeof(internal::MessageHeader),
- b.message()->data_num_bytes());
-
- const auto* msg_hdr =
- reinterpret_cast<const internal::MessageHeader*>(b.message()->data());
- EXPECT_EQ(123u, msg_hdr->name);
- EXPECT_EQ(0u, msg_hdr->flags);
- EXPECT_EQ(0u, msg_hdr->version);
-
- EXPECT_EQ(sizeof(internal::MessageHeader), msg_hdr->num_bytes);
-}
-
-TEST(MessageBuilderTest, RequestMessageBuilder) {
- char payload[41];
- RequestMessageBuilder b(123u, sizeof(payload));
-
- // The payload size should be a multiple of 8.
- EXPECT_EQ(48u, b.message()->payload_num_bytes());
- // Total data size should be payload size + message header size.
- EXPECT_EQ(48u + sizeof(internal::MessageHeaderWithRequestID),
- b.message()->data_num_bytes());
-
- const auto* msg_hdr =
- reinterpret_cast<const internal::MessageHeaderWithRequestID*>(
- b.message()->data());
- EXPECT_EQ(123u, msg_hdr->name);
- EXPECT_EQ(internal::kMessageExpectsResponse, msg_hdr->flags);
- EXPECT_EQ(1u, msg_hdr->version);
- EXPECT_EQ(0ul, msg_hdr->request_id);
- EXPECT_EQ(sizeof(internal::MessageHeaderWithRequestID), msg_hdr->num_bytes);
-}
-
-TEST(MessageBuilderTest, ResponseMessageBuilder) {
- char payload[41];
- ResponseMessageBuilder b(123u, sizeof(payload), 0ull);
-
- // The payload size should be a multiple of 8.
- EXPECT_EQ(48u, b.message()->payload_num_bytes());
- // Total data size should be payload size + message header size.
- EXPECT_EQ(48u + sizeof(internal::MessageHeaderWithRequestID),
- b.message()->data_num_bytes());
-
- const auto* msg_hdr =
- reinterpret_cast<const internal::MessageHeaderWithRequestID*>(
- b.message()->data());
- EXPECT_EQ(123u, msg_hdr->name);
- EXPECT_EQ(internal::kMessageIsResponse, msg_hdr->flags);
- EXPECT_EQ(1u, msg_hdr->version);
- EXPECT_EQ(0ul, msg_hdr->request_id);
- EXPECT_EQ(sizeof(internal::MessageHeaderWithRequestID), msg_hdr->num_bytes);
-}
-
-} // namespace
-} // namespace test
-} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/tests/map_unittest.cc ('k') | mojo/public/cpp/bindings/tests/message_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698