| 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 // Unit test for SyncChannel. | 5 // Unit test for SyncChannel. |
| 6 | 6 |
| 7 #include "ipc/ipc_sync_channel.h" | 7 #include "ipc/ipc_sync_channel.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 20 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 21 #include "base/threading/platform_thread.h" | 21 #include "base/threading/platform_thread.h" |
| 22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 23 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
| 24 #include "ipc/ipc_listener.h" |
| 24 #include "ipc/ipc_message.h" | 25 #include "ipc/ipc_message.h" |
| 26 #include "ipc/ipc_sender.h" |
| 25 #include "ipc/ipc_sync_message_filter.h" | 27 #include "ipc/ipc_sync_message_filter.h" |
| 26 #include "ipc/ipc_sync_message_unittest.h" | 28 #include "ipc/ipc_sync_message_unittest.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 28 | 30 |
| 29 using base::WaitableEvent; | 31 using base::WaitableEvent; |
| 30 | 32 |
| 31 namespace IPC { | 33 namespace IPC { |
| 32 | 34 |
| 33 namespace { | 35 namespace { |
| 34 | 36 |
| 35 // Base class for a "process" with listener and IPC threads. | 37 // Base class for a "process" with listener and IPC threads. |
| 36 class Worker : public Channel::Listener, public Message::Sender { | 38 class Worker : public Listener, public Sender { |
| 37 public: | 39 public: |
| 38 // Will create a channel without a name. | 40 // Will create a channel without a name. |
| 39 Worker(Channel::Mode mode, const std::string& thread_name) | 41 Worker(Channel::Mode mode, const std::string& thread_name) |
| 40 : done_(new WaitableEvent(false, false)), | 42 : done_(new WaitableEvent(false, false)), |
| 41 channel_created_(new WaitableEvent(false, false)), | 43 channel_created_(new WaitableEvent(false, false)), |
| 42 mode_(mode), | 44 mode_(mode), |
| 43 ipc_thread_((thread_name + "_ipc").c_str()), | 45 ipc_thread_((thread_name + "_ipc").c_str()), |
| 44 listener_thread_((thread_name + "_listener").c_str()), | 46 listener_thread_((thread_name + "_listener").c_str()), |
| 45 overrided_thread_(NULL), | 47 overrided_thread_(NULL), |
| 46 shutdown_event_(true, false) { | 48 shutdown_event_(true, false) { |
| (...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1952 | 1954 |
| 1953 } // namespace | 1955 } // namespace |
| 1954 | 1956 |
| 1955 // Windows needs to send an out-of-band secret to verify the client end of the | 1957 // Windows needs to send an out-of-band secret to verify the client end of the |
| 1956 // channel. Test that we still connect correctly in that case. | 1958 // channel. Test that we still connect correctly in that case. |
| 1957 TEST_F(IPCSyncChannelTest, Verified) { | 1959 TEST_F(IPCSyncChannelTest, Verified) { |
| 1958 Verified(); | 1960 Verified(); |
| 1959 } | 1961 } |
| 1960 | 1962 |
| 1961 } // namespace IPC | 1963 } // namespace IPC |
| OLD | NEW |