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

Unified Diff: mojo/common/common_custom_types_unittest.cc

Issue 1890643002: Mojo: add native type mapping for base::FilePath (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_typemap
Patch Set: Created 4 years, 8 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.typemap ('k') | mojo/common/test_common_custom_types.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/common_custom_types_unittest.cc
diff --git a/mojo/common/common_custom_types_unittest.cc b/mojo/common/common_custom_types_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2223c26c2d0956d45ff268bfad9029b87be61397
--- /dev/null
+++ b/mojo/common/common_custom_types_unittest.cc
@@ -0,0 +1,52 @@
+// 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/files/file_path.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "mojo/common/common_custom_types.mojom.h"
+#include "mojo/common/test_common_custom_types.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace common {
+namespace test {
+
+class TestFilePathImpl : public TestFilePath {
+ public:
+ explicit TestFilePathImpl(TestFilePathRequest request)
+ : binding_(this, std::move(request)) {}
+
+ // TestFilePath implementation:
+ void BounceFilePath(const base::FilePath& in,
+ const BounceFilePathCallback& callback) override {
+ callback.Run(in);
+ }
+
+ private:
+ mojo::Binding<TestFilePath> binding_;
+};
+
+TEST(CommonCustomTypesTest, FilePath) {
+ base::MessageLoop message_loop;
+ base::RunLoop run_loop;
+
+ TestFilePathPtr ptr;
+ TestFilePathImpl impl(GetProxy(&ptr));
+
+ base::FilePath dir(FILE_PATH_LITERAL("hello"));
+ base::FilePath file = dir.Append(FILE_PATH_LITERAL("world"));
+
+ ptr->BounceFilePath(file, [&run_loop, &file](const base::FilePath& out) {
+ EXPECT_EQ(file, out);
+ run_loop.Quit();
+ });
+
+ run_loop.Run();
+}
+
+} // namespace test
+} // namespace common
+} // namespace mojo
« no previous file with comments | « mojo/common/common_custom_types.typemap ('k') | mojo/common/test_common_custom_types.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698