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

Unified Diff: services/ui/common/gpu_type_converters_unittest.cc

Issue 2247183005: services/ui: Get rid of IPC::ChannelHandle type converter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review issues 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 | « services/ui/common/gpu_type_converters.cc ('k') | services/ui/gpu/gpu_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/common/gpu_type_converters_unittest.cc
diff --git a/services/ui/common/gpu_type_converters_unittest.cc b/services/ui/common/gpu_type_converters_unittest.cc
index 67b304761e24db3148d6fc97db0c64c7b8c22aec..33fc5dc02657d4a43bf7732c7592d7693f452486 100644
--- a/services/ui/common/gpu_type_converters_unittest.cc
+++ b/services/ui/common/gpu_type_converters_unittest.cc
@@ -6,81 +6,12 @@
#include "base/files/scoped_file.h"
#include "build/build_config.h"
-#include "ipc/ipc_channel.h"
-#include "ipc/ipc_channel_handle.h"
#include "services/ui/common/gpu_type_converters.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
-// Test for mojo TypeConverter of ui::mojom::ChannelHandle.
-TEST(MusGpuTypeConvertersTest, ChannelHandle) {
- {
- const std::string channel_name = "test_channel_name";
- IPC::ChannelHandle handle(channel_name);
-
- ui::mojom::ChannelHandlePtr mojo_handle =
- ui::mojom::ChannelHandle::From(handle);
- ASSERT_EQ(mojo_handle->name, channel_name);
- EXPECT_FALSE(mojo_handle->socket.is_valid());
-
- handle = mojo_handle.To<IPC::ChannelHandle>();
- ASSERT_EQ(handle.name, channel_name);
-#if defined(OS_POSIX)
- ASSERT_EQ(handle.socket.fd, -1);
-#endif
- }
-
-#if defined(OS_POSIX)
- {
- const std::string channel_name = "test_channel_name";
- int fd1 = -1;
- int fd2 = -1;
- bool result = IPC::SocketPair(&fd1, &fd2);
- EXPECT_TRUE(result);
-
- base::ScopedFD scoped_fd1(fd1);
- base::ScopedFD scoped_fd2(fd2);
- IPC::ChannelHandle handle(channel_name,
- base::FileDescriptor(scoped_fd1.release(), true));
-
- ui::mojom::ChannelHandlePtr mojo_handle =
- ui::mojom::ChannelHandle::From(handle);
- ASSERT_EQ(mojo_handle->name, channel_name);
- EXPECT_TRUE(mojo_handle->socket.is_valid());
-
- handle = mojo_handle.To<IPC::ChannelHandle>();
- ASSERT_EQ(handle.name, channel_name);
- ASSERT_NE(handle.socket.fd, -1);
- EXPECT_TRUE(handle.socket.auto_close);
- base::ScopedFD socped_fd3(handle.socket.fd);
- }
-#endif
-
- {
- const std::string channel_name = "test_channel_name";
- mojo::MessagePipe message_pipe;
- mojo::MessagePipeHandle mp_handle = message_pipe.handle0.release();
- EXPECT_TRUE(mp_handle.is_valid());
- IPC::ChannelHandle handle(mp_handle);
- handle.name = channel_name;
-
- ui::mojom::ChannelHandlePtr mojo_handle =
- ui::mojom::ChannelHandle::From(handle);
- ASSERT_EQ(mojo_handle->name, channel_name);
- ASSERT_EQ(mojo_handle->mojo_handle.get(), mp_handle);
- EXPECT_FALSE(mojo_handle->socket.is_valid());
-
- handle = mojo_handle.To<IPC::ChannelHandle>();
- ASSERT_EQ(handle.name, channel_name);
- ASSERT_EQ(handle.mojo_handle, mp_handle);
-#if defined(OS_POSIX)
- ASSERT_EQ(handle.socket.fd, -1);
-#endif
- }
-}
-
// Test for mojo TypeConverter of ui::mojom::GpuMemoryBufferHandle
TEST(MusGpuTypeConvertersTest, GpuMemoryBufferHandle) {
const gfx::GpuMemoryBufferId kId(99);
« no previous file with comments | « services/ui/common/gpu_type_converters.cc ('k') | services/ui/gpu/gpu_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698