| 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 <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // Similar to SendHandle, except the attachment's destination process is this | 273 // Similar to SendHandle, except the attachment's destination process is this |
| 274 // process. This is an unrealistic scenario, but simulates an unprivileged | 274 // process. This is an unrealistic scenario, but simulates an unprivileged |
| 275 // process sending an attachment to another unprivileged process. | 275 // process sending an attachment to another unprivileged process. |
| 276 TEST_F(IPCAttachmentBrokerPrivilegedWinTest, SendHandleToSelf) { | 276 TEST_F(IPCAttachmentBrokerPrivilegedWinTest, SendHandleToSelf) { |
| 277 Init("SendHandleToSelf"); | 277 Init("SendHandleToSelf"); |
| 278 | 278 |
| 279 set_broker(new MockBroker); | 279 set_broker(new MockBroker); |
| 280 CommonSetUp(); | 280 CommonSetUp(); |
| 281 // Technically, the channel is an endpoint, but we need the proxy listener to | 281 // Technically, the channel is an endpoint, but we need the proxy listener to |
| 282 // receive the messages so that it can quit the message loop. | 282 // receive the messages so that it can quit the message loop. |
| 283 channel()->set_attachment_broker_endpoint(false); | 283 channel()->SetAttachmentBrokerEndpoint(false); |
| 284 get_proxy_listener()->set_listener(get_broker()); | 284 get_proxy_listener()->set_listener(get_broker()); |
| 285 | 285 |
| 286 HANDLE h = CreateTempFile(); | 286 HANDLE h = CreateTempFile(); |
| 287 SendMessageWithAttachment(h); | 287 SendMessageWithAttachment(h); |
| 288 base::MessageLoop::current()->Run(); | 288 base::MessageLoop::current()->Run(); |
| 289 | 289 |
| 290 // Get the received attachment. | 290 // Get the received attachment. |
| 291 IPC::BrokerableAttachment::AttachmentId* id = get_observer()->get_id(); | 291 IPC::BrokerableAttachment::AttachmentId* id = get_observer()->get_id(); |
| 292 scoped_refptr<IPC::BrokerableAttachment> received_attachment; | 292 scoped_refptr<IPC::BrokerableAttachment> received_attachment; |
| 293 get_broker()->GetAttachmentWithId(*id, &received_attachment); | 293 get_broker()->GetAttachmentWithId(*id, &received_attachment); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // Do nothing special. The default behavior already runs the | 393 // Do nothing special. The default behavior already runs the |
| 394 // AttachmentBrokerPrivilegedWin. | 394 // AttachmentBrokerPrivilegedWin. |
| 395 } | 395 } |
| 396 | 396 |
| 397 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleToSelf) { | 397 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleToSelf) { |
| 398 return CommonPrivilegedProcessMain(&SendHandleToSelfCallback, | 398 return CommonPrivilegedProcessMain(&SendHandleToSelfCallback, |
| 399 "SendHandleToSelf"); | 399 "SendHandleToSelf"); |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace | 402 } // namespace |
| OLD | NEW |