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

Unified Diff: mojo/public/cpp/bindings/tests/interface_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/interface_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/interface_unittest.cc b/mojo/public/cpp/bindings/tests/interface_unittest.cc
deleted file mode 100644
index 68fc6b808b8c461f9d06488bc5c0c00770d8a92b..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/tests/interface_unittest.cc
+++ /dev/null
@@ -1,78 +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 <memory>
-
-#include "gtest/gtest.h"
-#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
-
-using sample::SampleInterface;
-using sample::SampleInterface_SampleMethod1_Params;
-using sample::SampleInterface_SampleMethod1_ResponseParams;
-
-namespace mojo {
-namespace test {
-namespace {
-
-// Test the validity of the generated ordinals for interface methods.
-TEST(SampleInterfaceOrdinals, CheckGeneratedOrdinals) {
- EXPECT_EQ(0U, static_cast<uint32_t>(
- SampleInterface::MessageOrdinals::SampleMethod0));
- EXPECT_EQ(1U, static_cast<uint32_t>(
- SampleInterface::MessageOrdinals::SampleMethod1));
- EXPECT_EQ(2U, static_cast<uint32_t>(
- SampleInterface::MessageOrdinals::SampleMethod2));
-}
-
-// Test that a request params struct is generated for interface methods, and
-// test that it is serializable.
-TEST(SampleInterfaceGeneratedStructs, RequestStruct) {
- SampleInterface_SampleMethod1_Params params;
- params.in1 = 123;
- params.in2.reset();
-
- size_t size = params.GetSerializedSize();
- EXPECT_EQ(8U // Struct header
- + (4U // |in1| field
- + 8U) // |in2| offset to string (which is null)
- + 4U, // padding to make the struct 8-byte aligned
- size);
-
- std::unique_ptr<char[]> bytes(new char[size]);
- EXPECT_TRUE(params.Serialize(bytes.get(), size));
-
- auto* params_data = reinterpret_cast<
- sample::internal::SampleInterface_SampleMethod1_Params_Data*>(
- bytes.get());
- EXPECT_EQ(123, params_data->in1);
- EXPECT_EQ(0UL, params_data->in2.offset);
-}
-
-// Test that a response params struct is generated for interface methods, and
-// test that it is serializable.
-TEST(SampleInterfaceGeneratedStructs, ResponseStruct) {
- SampleInterface_SampleMethod1_ResponseParams params;
- params.out1.reset();
- params.out2 = sample::Enum::VALUE;
-
- size_t size = params.GetSerializedSize();
- EXPECT_EQ(8U // Struct header
- + (8U // |out1| offset to string (which is null)
- + 4U) // |out2| enum
- + 4U, // padding to make the struct 8-byte aligned
- size);
-
- std::unique_ptr<char[]> bytes(new char[size]);
- EXPECT_TRUE(params.Serialize(bytes.get(), size));
-
- auto* params_data = reinterpret_cast<
- sample::internal::SampleInterface_SampleMethod1_ResponseParams_Data*>(
- bytes.get());
- EXPECT_EQ(0UL, params_data->out1.offset);
- EXPECT_EQ(sample::Enum::VALUE, static_cast<sample::Enum>(params_data->out2));
-}
-
-} // namespace
-} // namespace test
-} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc ('k') | mojo/public/cpp/bindings/tests/iterator_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698