OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // These tests are POSIX only. | 5 // These tests are POSIX only. |
6 | 6 |
7 #include "ipc/ipc_channel_posix.h" | 7 #include "ipc/ipc_channel_posix.h" |
8 | 8 |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 IPCChannelPosixTestListener listener(false); | 368 IPCChannelPosixTestListener listener(false); |
369 IPC::ChannelHandle chan_handle(GetConnectionSocketName()); | 369 IPC::ChannelHandle chan_handle(GetConnectionSocketName()); |
370 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NONE, &listener); | 370 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NONE, &listener); |
371 ASSERT_FALSE(channel.Connect()); | 371 ASSERT_FALSE(channel.Connect()); |
372 } | 372 } |
373 | 373 |
374 TEST_F(IPCChannelPosixTest, IsNamedServerInitialized) { | 374 TEST_F(IPCChannelPosixTest, IsNamedServerInitialized) { |
375 const std::string& connection_socket_name = GetConnectionSocketName(); | 375 const std::string& connection_socket_name = GetConnectionSocketName(); |
376 IPCChannelPosixTestListener listener(false); | 376 IPCChannelPosixTestListener listener(false); |
377 IPC::ChannelHandle chan_handle(connection_socket_name); | 377 IPC::ChannelHandle chan_handle(connection_socket_name); |
378 ASSERT_TRUE(file_util::Delete(base::FilePath(connection_socket_name), false)); | 378 ASSERT_TRUE(base::Delete(base::FilePath(connection_socket_name), false)); |
379 ASSERT_FALSE(IPC::Channel::IsNamedServerInitialized( | 379 ASSERT_FALSE(IPC::Channel::IsNamedServerInitialized( |
380 connection_socket_name)); | 380 connection_socket_name)); |
381 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener); | 381 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener); |
382 ASSERT_TRUE(IPC::Channel::IsNamedServerInitialized( | 382 ASSERT_TRUE(IPC::Channel::IsNamedServerInitialized( |
383 connection_socket_name)); | 383 connection_socket_name)); |
384 channel.Close(); | 384 channel.Close(); |
385 ASSERT_FALSE(IPC::Channel::IsNamedServerInitialized( | 385 ASSERT_FALSE(IPC::Channel::IsNamedServerInitialized( |
386 connection_socket_name)); | 386 connection_socket_name)); |
387 } | 387 } |
388 | 388 |
(...skipping 27 matching lines...) Expand all Loading... |
416 if (connected) { | 416 if (connected) { |
417 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout()); | 417 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout()); |
418 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); | 418 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); |
419 } else { | 419 } else { |
420 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); | 420 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); |
421 } | 421 } |
422 return 0; | 422 return 0; |
423 } | 423 } |
424 | 424 |
425 } // namespace | 425 } // namespace |
OLD | NEW |