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

Unified Diff: mojo/common/struct_traits_unittest.cc

Issue 2147693002: Struct traits used by GpuInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: The right public_deps 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/common/common_custom_types_struct_traits_unittest.cc ('k') | mojo/common/traits_test_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/struct_traits_unittest.cc
diff --git a/mojo/common/struct_traits_unittest.cc b/mojo/common/struct_traits_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..054519d8fff450f4429e427da6df46a216a15477
--- /dev/null
+++ b/mojo/common/struct_traits_unittest.cc
@@ -0,0 +1,49 @@
+// 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 "base/message_loop/message_loop.h"
+#include "mojo/common/traits_test_service.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace common {
+namespace {
+
+class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
+ public:
+ StructTraitsTest() {}
+
+ protected:
+ mojom::TraitsTestServicePtr GetTraitsTestProxy() {
+ return traits_test_bindings_.CreateInterfacePtrAndBind(this);
+ }
+
+ private:
+ // TraitsTestService:
+ void EchoVersion(const base::Version& m,
+ const EchoVersionCallback& callback) override {
+ callback.Run(m);
+ }
+
+ base::MessageLoop loop_;
+ mojo::BindingSet<TraitsTestService> traits_test_bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
+};
+
+TEST_F(StructTraitsTest, Version) {
+ const std::string& version_str = "1.2.3.4";
+ base::Version input(version_str);
+ mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
+ base::Version output;
+ proxy->EchoVersion(input, &output);
+ base::Version test_version(version_str);
+
+ EXPECT_EQ(version_str, output.GetString());
+}
+
+} // namespace
+} // namespace common
+} // namespace mojo
« no previous file with comments | « mojo/common/common_custom_types_struct_traits_unittest.cc ('k') | mojo/common/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698