| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
| 12 #include "base/run_loop.h" |
| 12 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 13 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
| 14 #include "ipc/ipc_test_base.h" | 15 #include "ipc/ipc_test_base.h" |
| 15 #include "ipc/message_filter.h" | 16 #include "ipc/message_filter.h" |
| 16 | 17 |
| 17 // Get basic type definitions. | 18 // Get basic type definitions. |
| 18 #define IPC_MESSAGE_IMPL | 19 #define IPC_MESSAGE_IMPL |
| 19 #include "ipc/ipc_channel_proxy_unittest_messages.h" | 20 #include "ipc/ipc_channel_proxy_unittest_messages.h" |
| 20 | 21 |
| 21 // Generate constructors. | 22 // Generate constructors. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 254 |
| 254 void TearDown() override { | 255 void TearDown() override { |
| 255 DestroyChannelProxy(); | 256 DestroyChannelProxy(); |
| 256 thread_.reset(); | 257 thread_.reset(); |
| 257 listener_.reset(); | 258 listener_.reset(); |
| 258 IPCTestBase::TearDown(); | 259 IPCTestBase::TearDown(); |
| 259 } | 260 } |
| 260 | 261 |
| 261 void SendQuitMessageAndWaitForIdle() { | 262 void SendQuitMessageAndWaitForIdle() { |
| 262 sender()->Send(new WorkerMsg_Quit); | 263 sender()->Send(new WorkerMsg_Quit); |
| 263 base::MessageLoop::current()->Run(); | 264 base::RunLoop().Run(); |
| 264 EXPECT_TRUE(WaitForClientShutdown()); | 265 EXPECT_TRUE(WaitForClientShutdown()); |
| 265 } | 266 } |
| 266 | 267 |
| 267 bool DidListenerGetBadMessage() { | 268 bool DidListenerGetBadMessage() { |
| 268 return listener_->bad_message_received_; | 269 return listener_->bad_message_received_; |
| 269 } | 270 } |
| 270 | 271 |
| 271 private: | 272 private: |
| 272 std::unique_ptr<base::Thread> thread_; | 273 std::unique_ptr<base::Thread> thread_; |
| 273 std::unique_ptr<QuitListener> listener_; | 274 std::unique_ptr<QuitListener> listener_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 ASSERT_TRUE(StartClient()); | 394 ASSERT_TRUE(StartClient()); |
| 394 } | 395 } |
| 395 | 396 |
| 396 void TearDown() override { | 397 void TearDown() override { |
| 397 listener_.reset(); | 398 listener_.reset(); |
| 398 IPCTestBase::TearDown(); | 399 IPCTestBase::TearDown(); |
| 399 } | 400 } |
| 400 | 401 |
| 401 void SendQuitMessageAndWaitForIdle() { | 402 void SendQuitMessageAndWaitForIdle() { |
| 402 sender()->Send(new WorkerMsg_Quit); | 403 sender()->Send(new WorkerMsg_Quit); |
| 403 base::MessageLoop::current()->Run(); | 404 base::RunLoop().Run(); |
| 404 EXPECT_TRUE(WaitForClientShutdown()); | 405 EXPECT_TRUE(WaitForClientShutdown()); |
| 405 } | 406 } |
| 406 | 407 |
| 407 bool DidListenerGetBadMessage() { | 408 bool DidListenerGetBadMessage() { |
| 408 return listener_->bad_message_received_; | 409 return listener_->bad_message_received_; |
| 409 } | 410 } |
| 410 | 411 |
| 411 private: | 412 private: |
| 412 std::unique_ptr<QuitListener> listener_; | 413 std::unique_ptr<QuitListener> listener_; |
| 413 }; | 414 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 424 #endif | 425 #endif |
| 425 | 426 |
| 426 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ChannelProxyClient) { | 427 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ChannelProxyClient) { |
| 427 base::MessageLoopForIO main_message_loop; | 428 base::MessageLoopForIO main_message_loop; |
| 428 ChannelReflectorListener listener; | 429 ChannelReflectorListener listener; |
| 429 std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( | 430 std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient( |
| 430 IPCTestBase::GetChannelName("ChannelProxyClient"), &listener)); | 431 IPCTestBase::GetChannelName("ChannelProxyClient"), &listener)); |
| 431 CHECK(channel->Connect()); | 432 CHECK(channel->Connect()); |
| 432 listener.Init(channel.get()); | 433 listener.Init(channel.get()); |
| 433 | 434 |
| 434 base::MessageLoop::current()->Run(); | 435 base::RunLoop().Run(); |
| 435 return 0; | 436 return 0; |
| 436 } | 437 } |
| 437 | 438 |
| 438 } // namespace | 439 } // namespace |
| OLD | NEW |