| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 418 } |
| 419 | 419 |
| 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_, io_task_runner()); |
| 429 CreateChannel(&proxy_listener_); | 429 CreateChannel(&proxy_listener_); |
| 430 broker_->DesignateBrokerCommunicationChannel(channel()); | 430 broker_->DesignateBrokerCommunicationChannel(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 |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 // Channel. | 956 // Channel. |
| 957 TEST_F(IPCAttachmentBrokerMacTest, SendSharedMemoryHandleChannelProxy) { | 957 TEST_F(IPCAttachmentBrokerMacTest, SendSharedMemoryHandleChannelProxy) { |
| 958 // Mach-based SharedMemory isn't support on OSX 10.6. | 958 // Mach-based SharedMemory isn't support on OSX 10.6. |
| 959 if (base::mac::IsOSSnowLeopard()) | 959 if (base::mac::IsOSSnowLeopard()) |
| 960 return; | 960 return; |
| 961 | 961 |
| 962 Init("SendSharedMemoryHandleChannelProxy"); | 962 Init("SendSharedMemoryHandleChannelProxy"); |
| 963 MachPreForkSetUp(); | 963 MachPreForkSetUp(); |
| 964 | 964 |
| 965 SetBroker(new IPC::AttachmentBrokerUnprivilegedMac); | 965 SetBroker(new IPC::AttachmentBrokerUnprivilegedMac); |
| 966 get_broker()->AddObserver(get_observer(), task_runner()); | 966 get_broker()->AddObserver(get_observer(), io_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()->DesignateBrokerCommunicationChannel(channel_proxy()); |
| 976 | 976 |
| (...skipping 349 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 |