Chromium Code Reviews| Index: ipc/ipc_sync_channel_unittest.cc |
| diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc |
| index fe17c148cd7e6896b8c34d1af0f742d788a3b1e6..e5135314c347b2358cac094979bfc9767ec423df 100644 |
| --- a/ipc/ipc_sync_channel_unittest.cc |
| +++ b/ipc/ipc_sync_channel_unittest.cc |
| @@ -24,10 +24,9 @@ |
| #include "ipc/ipc_sync_message_unittest.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -using namespace IPC; |
| using base::WaitableEvent; |
| -namespace { |
|
brettw
2011/05/13 19:13:40
I think we still want to keep the anonymous namesp
KushalP
2011/05/13 19:19:17
Done.
|
| +namespace IPC { |
| // Base class for a "process" with listener and IPC threads. |
| class Worker : public Channel::Listener, public Message::Sender { |
| @@ -254,8 +253,6 @@ void RunTest(std::vector<Worker*> workers) { |
| STLDeleteContainerPointers(workers.begin(), workers.end()); |
| } |
| -} // namespace |
| - |
| class IPCSyncChannelTest : public testing::Test { |
| private: |
| MessageLoop message_loop_; |
| @@ -263,8 +260,6 @@ class IPCSyncChannelTest : public testing::Test { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class SimpleServer : public Worker { |
| public: |
| explicit SimpleServer(bool pump_during_send) |
| @@ -295,8 +290,6 @@ void Simple(bool pump_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests basic synchronous call |
| TEST_F(IPCSyncChannelTest, Simple) { |
| Simple(false); |
| @@ -305,8 +298,6 @@ TEST_F(IPCSyncChannelTest, Simple) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class DelayClient : public Worker { |
| public: |
| DelayClient() : Worker(Channel::MODE_CLIENT, "delay_client") { } |
| @@ -325,8 +316,6 @@ void DelayReply(bool pump_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that asynchronous replies work |
| TEST_F(IPCSyncChannelTest, DelayReply) { |
| DelayReply(false); |
| @@ -335,8 +324,6 @@ TEST_F(IPCSyncChannelTest, DelayReply) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class NoHangServer : public Worker { |
| public: |
| explicit NoHangServer(WaitableEvent* got_first_reply, bool pump_during_send) |
| @@ -382,8 +369,6 @@ void NoHang(bool pump_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that caller doesn't hang if receiver dies |
| TEST_F(IPCSyncChannelTest, NoHang) { |
| NoHang(false); |
| @@ -392,8 +377,6 @@ TEST_F(IPCSyncChannelTest, NoHang) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class UnblockServer : public Worker { |
| public: |
| UnblockServer(bool pump_during_send, bool delete_during_send) |
| @@ -448,8 +431,6 @@ void Unblock(bool server_pump, bool client_pump, bool delete_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that the caller unblocks to answer a sync message from the receiver. |
| TEST_F(IPCSyncChannelTest, Unblock) { |
| Unblock(false, false, false); |
| @@ -460,7 +441,7 @@ TEST_F(IPCSyncChannelTest, Unblock) { |
| //----------------------------------------------------------------------------- |
| -// Tests that the the IPC::SyncChannel object can be deleted during a Send. |
| +// Tests that the the SyncChannel object can be deleted during a Send. |
| TEST_F(IPCSyncChannelTest, ChannelDeleteDuringSend) { |
| Unblock(false, false, true); |
| Unblock(false, true, true); |
| @@ -470,8 +451,6 @@ TEST_F(IPCSyncChannelTest, ChannelDeleteDuringSend) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class RecursiveServer : public Worker { |
| public: |
| explicit RecursiveServer( |
| @@ -531,8 +510,6 @@ void Recursive( |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests a server calling Send while another Send is pending. |
| TEST_F(IPCSyncChannelTest, Recursive) { |
| Recursive(false, false, false); |
| @@ -547,8 +524,6 @@ TEST_F(IPCSyncChannelTest, Recursive) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| void RecursiveNoHang( |
| bool server_pump_first, bool server_pump_second, bool client_pump) { |
| std::vector<Worker*> workers; |
| @@ -558,8 +533,6 @@ void RecursiveNoHang( |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that if a caller makes a sync call during an existing sync call and |
| // the receiver dies, neither of the Send() calls hang. |
| TEST_F(IPCSyncChannelTest, RecursiveNoHang) { |
| @@ -575,8 +548,6 @@ TEST_F(IPCSyncChannelTest, RecursiveNoHang) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class MultipleServer1 : public Worker { |
| public: |
| explicit MultipleServer1(bool pump_during_send) |
| @@ -676,8 +647,6 @@ void Multiple(bool server_pump, bool client_pump) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that multiple SyncObjects on the same listener thread can unblock each |
| // other. |
| TEST_F(IPCSyncChannelTest, Multiple) { |
| @@ -689,8 +658,6 @@ TEST_F(IPCSyncChannelTest, Multiple) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| // This class provides server side functionality to test the case where |
| // multiple sync channels are in use on the same thread on the client and |
| // nested calls are issued. |
| @@ -788,8 +755,6 @@ void QueuedReply(bool client_pump) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // While a blocking send is in progress, the listener thread might answer other |
| // synchronous messages. This tests that if during the response to another |
| // message the reply to the original messages comes, it is queued up correctly |
| @@ -803,8 +768,6 @@ TEST_F(IPCSyncChannelTest, QueuedReply) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| void DropAssert(const std::string&) {} |
| class BadServer : public Worker { |
| @@ -846,8 +809,6 @@ void BadMessage(bool pump_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that if a message is not serialized correctly, the Send() will fail. |
| TEST_F(IPCSyncChannelTest, BadMessage) { |
| BadMessage(false); |
| @@ -856,8 +817,6 @@ TEST_F(IPCSyncChannelTest, BadMessage) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class ChattyClient : public Worker { |
| public: |
| ChattyClient() : |
| @@ -883,8 +842,6 @@ void ChattyServer(bool pump_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests http://b/1093251 - that sending lots of sync messages while |
| // the receiver is waiting for a sync reply does not overflow the PostMessage |
| // queue. |
| @@ -895,8 +852,6 @@ TEST_F(IPCSyncChannelTest, ChattyServer) { |
| //------------------------------------------------------------------------------ |
| -namespace { |
| - |
| class TimeoutServer : public Worker { |
| public: |
| TimeoutServer(int timeout_ms, |
| @@ -983,8 +938,6 @@ void SendWithTimeoutMixedOKAndTimeout(bool pump_during_send) { |
| RunTest(workers); |
| } |
| -} // namespace |
| - |
| // Tests that SendWithTimeout does not time-out if the response comes back fast |
| // enough. |
| TEST_F(IPCSyncChannelTest, SendWithTimeoutOK) { |
| @@ -1007,8 +960,6 @@ TEST_F(IPCSyncChannelTest, DISABLED_SendWithTimeoutMixedOKAndTimeout) { |
| //------------------------------------------------------------------------------ |
| -namespace { |
| - |
| class NestedTask : public Task { |
| public: |
| explicit NestedTask(Worker* server) : server_(server) { } |
| @@ -1048,8 +999,6 @@ class DoneEventRaceServer : public Worker { |
| } |
| }; |
| -} // namespace |
| - |
| // Tests http://b/1474092 - that if after the done_event is set but before |
| // OnObjectSignaled is called another message is sent out, then after its |
| // reply comes back OnObjectSignaled will be called for the first message. |
| @@ -1062,9 +1011,7 @@ TEST_F(IPCSyncChannelTest, DoneEventRace) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| -class TestSyncMessageFilter : public IPC::SyncMessageFilter { |
| +class TestSyncMessageFilter : public SyncMessageFilter { |
| public: |
| TestSyncMessageFilter(base::WaitableEvent* shutdown_event, Worker* worker) |
| : SyncMessageFilter(shutdown_event), |
| @@ -1142,8 +1089,6 @@ class ServerSendAfterClose : public Worker { |
| bool send_result_; |
| }; |
| -} // namespace |
| - |
| // Tests basic synchronous call |
| TEST_F(IPCSyncChannelTest, SyncMessageFilter) { |
| std::vector<Worker*> workers; |
| @@ -1168,8 +1113,6 @@ TEST_F(IPCSyncChannelTest, SendAfterClose) { |
| //----------------------------------------------------------------------------- |
| -namespace { |
| - |
| class RestrictedDispatchServer : public Worker { |
| public: |
| RestrictedDispatchServer(WaitableEvent* sent_ping_event) |
| @@ -1178,7 +1121,7 @@ class RestrictedDispatchServer : public Worker { |
| void OnDoPing(int ping) { |
| // Send an asynchronous message that unblocks the caller. |
| - IPC::Message* msg = new SyncChannelTestMsg_Ping(ping); |
| + Message* msg = new SyncChannelTestMsg_Ping(ping); |
| msg->set_unblock(true); |
| Send(msg); |
| // Signal the event after the message has been sent on the channel, on the |
| @@ -1299,8 +1242,6 @@ class RestrictedDispatchClient : public Worker { |
| WaitableEvent* sent_ping_event_; |
| }; |
| -} // namespace |
| - |
| TEST_F(IPCSyncChannelTest, RestrictedDispatch) { |
| WaitableEvent sent_ping_event(false, false); |
| @@ -1315,3 +1256,5 @@ TEST_F(IPCSyncChannelTest, RestrictedDispatch) { |
| RunTest(workers); |
| EXPECT_EQ(3, success); |
| } |
| + |
| +} // namespace IPC |