| 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> |
| 11 #include <sys/un.h> | 11 #include <sys/un.h> |
| 12 #include <unistd.h> | 12 #include <unistd.h> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/eintr_wrapper.h" | 15 #include "base/eintr_wrapper.h" |
| 16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
| 17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "base/test/multiprocess_test.h" | 21 #include "base/test/multiprocess_test.h" |
| 22 #include "base/test/test_timeouts.h" | 22 #include "base/test/test_timeouts.h" |
| 23 #include "ipc/ipc_listener.h" |
| 23 #include "testing/multiprocess_func_list.h" | 24 #include "testing/multiprocess_func_list.h" |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 static const uint32 kQuitMessage = 47; | 28 static const uint32 kQuitMessage = 47; |
| 28 | 29 |
| 29 class IPCChannelPosixTestListener : public IPC::Channel::Listener { | 30 class IPCChannelPosixTestListener : public IPC::Listener { |
| 30 public: | 31 public: |
| 31 enum STATUS { | 32 enum STATUS { |
| 32 DISCONNECTED, | 33 DISCONNECTED, |
| 33 MESSAGE_RECEIVED, | 34 MESSAGE_RECEIVED, |
| 34 CHANNEL_ERROR, | 35 CHANNEL_ERROR, |
| 35 CONNECTED, | 36 CONNECTED, |
| 36 DENIED, | 37 DENIED, |
| 37 LISTEN_ERROR | 38 LISTEN_ERROR |
| 38 }; | 39 }; |
| 39 | 40 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // it. | 418 // it. |
| 418 bool connected = channel.Connect(); | 419 bool connected = channel.Connect(); |
| 419 if (connected) { | 420 if (connected) { |
| 420 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); | 421 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); |
| 421 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); | 422 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); |
| 422 } else { | 423 } else { |
| 423 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); | 424 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); |
| 424 } | 425 } |
| 425 return 0; | 426 return 0; |
| 426 } | 427 } |
| OLD | NEW |