| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <mach/mach_vm.h> | 8 #include <mach/mach_vm.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Setup shared between tests. | 420 // Setup shared between tests. |
| 421 void CommonSetUp(const char* name) { | 421 void CommonSetUp(const char* name) { |
| 422 Init(name); | 422 Init(name); |
| 423 MachPreForkSetUp(); | 423 MachPreForkSetUp(); |
| 424 | 424 |
| 425 if (!broker_.get()) | 425 if (!broker_.get()) |
| 426 SetBroker(new IPC::AttachmentBrokerUnprivilegedMac); | 426 SetBroker(new IPC::AttachmentBrokerUnprivilegedMac); |
| 427 | 427 |
| 428 broker_->AddObserver(&observer_, task_runner()); | 428 broker_->AddObserver(&observer_, task_runner()); |
| 429 CreateChannel(&proxy_listener_); | 429 CreateChannel(&proxy_listener_); |
| 430 broker_->DesignateBrokerCommunicationChannel(channel()); | 430 broker_->RegisterBrokerCommunicationChannel(channel()); |
| 431 ASSERT_TRUE(ConnectChannel()); | 431 ASSERT_TRUE(ConnectChannel()); |
| 432 ASSERT_TRUE(StartClient()); | 432 ASSERT_TRUE(StartClient()); |
| 433 | 433 |
| 434 MachPostForkSetUp(); | 434 MachPostForkSetUp(); |
| 435 active_names_at_start_ = IPC::GetActiveNameCount(); | 435 active_names_at_start_ = IPC::GetActiveNameCount(); |
| 436 get_proxy_listener()->set_listener(&result_listener_); | 436 get_proxy_listener()->set_listener(&result_listener_); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void CheckChildResult() { | 439 void CheckChildResult() { |
| 440 ASSERT_EQ(ProxyListener::MESSAGE_RECEIVED, | 440 ASSERT_EQ(ProxyListener::MESSAGE_RECEIVED, |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 SetBroker(new IPC::AttachmentBrokerUnprivilegedMac); | 965 SetBroker(new IPC::AttachmentBrokerUnprivilegedMac); |
| 966 get_broker()->AddObserver(get_observer(), task_runner()); | 966 get_broker()->AddObserver(get_observer(), task_runner()); |
| 967 | 967 |
| 968 scoped_ptr<base::Thread> thread( | 968 scoped_ptr<base::Thread> thread( |
| 969 new base::Thread("ChannelProxyTestServerThread")); | 969 new base::Thread("ChannelProxyTestServerThread")); |
| 970 base::Thread::Options options; | 970 base::Thread::Options options; |
| 971 options.message_loop_type = base::MessageLoop::TYPE_IO; | 971 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 972 thread->StartWithOptions(options); | 972 thread->StartWithOptions(options); |
| 973 | 973 |
| 974 CreateChannelProxy(get_proxy_listener(), thread->task_runner().get()); | 974 CreateChannelProxy(get_proxy_listener(), thread->task_runner().get()); |
| 975 get_broker()->DesignateBrokerCommunicationChannel(channel_proxy()); | 975 get_broker()->RegisterBrokerCommunicationChannel(channel_proxy()); |
| 976 | 976 |
| 977 ASSERT_TRUE(StartClient()); | 977 ASSERT_TRUE(StartClient()); |
| 978 | 978 |
| 979 MachPostForkSetUp(); | 979 MachPostForkSetUp(); |
| 980 active_names_at_start_ = IPC::GetActiveNameCount(); | 980 active_names_at_start_ = IPC::GetActiveNameCount(); |
| 981 get_proxy_listener()->set_listener(get_result_listener()); | 981 get_proxy_listener()->set_listener(get_result_listener()); |
| 982 | 982 |
| 983 SendMessage1(kDataBuffer1); | 983 SendMessage1(kDataBuffer1); |
| 984 base::MessageLoop::current()->Run(); | 984 base::MessageLoop::current()->Run(); |
| 985 | 985 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 SendControlMessage(sender, success); | 1326 SendControlMessage(sender, success); |
| 1327 } | 1327 } |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(MemoryUsageManyMessages) { | 1330 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(MemoryUsageManyMessages) { |
| 1331 return CommonPrivilegedProcessMain(&MemoryUsageManyMessagesCallback, | 1331 return CommonPrivilegedProcessMain(&MemoryUsageManyMessagesCallback, |
| 1332 "MemoryUsageManyMessages"); | 1332 "MemoryUsageManyMessages"); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 } // namespace | 1335 } // namespace |
| OLD | NEW |