| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 scoped_ptr<IPC::AttachmentBrokerUnprivilegedWin> broker_; | 269 scoped_ptr<IPC::AttachmentBrokerUnprivilegedWin> broker_; |
| 270 MockObserver observer_; | 270 MockObserver observer_; |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 // A broker which always sets the current process as the destination process | 273 // A broker which always sets the current process as the destination process |
| 274 // for attachments. | 274 // for attachments. |
| 275 class MockBroker : public IPC::AttachmentBrokerUnprivilegedWin { | 275 class MockBroker : public IPC::AttachmentBrokerUnprivilegedWin { |
| 276 public: | 276 public: |
| 277 MockBroker() {} | 277 MockBroker() {} |
| 278 ~MockBroker() override {} | 278 ~MockBroker() override {} |
| 279 bool SendAttachmentToProcess(IPC::BrokerableAttachment* attachment, | 279 bool SendAttachmentToProcess( |
| 280 base::ProcessId destination_process) override { | 280 const scoped_refptr<IPC::BrokerableAttachment>& attachment, |
| 281 base::ProcessId destination_process) override { |
| 281 return IPC::AttachmentBrokerUnprivilegedWin::SendAttachmentToProcess( | 282 return IPC::AttachmentBrokerUnprivilegedWin::SendAttachmentToProcess( |
| 282 attachment, base::Process::Current().Pid()); | 283 attachment, base::Process::Current().Pid()); |
| 283 } | 284 } |
| 284 }; | 285 }; |
| 285 | 286 |
| 286 // An unprivileged process makes a file HANDLE, and writes a string to it. The | 287 // An unprivileged process makes a file HANDLE, and writes a string to it. The |
| 287 // file HANDLE is sent to the privileged process using the attachment broker. | 288 // file HANDLE is sent to the privileged process using the attachment broker. |
| 288 // The privileged process dups the HANDLE into its own HANDLE table. This test | 289 // The privileged process dups the HANDLE into its own HANDLE table. This test |
| 289 // checks that the file has the same contents in the privileged process. | 290 // checks that the file has the same contents in the privileged process. |
| 290 TEST_F(IPCAttachmentBrokerPrivilegedWinTest, DISABLED_SendHandle) { | 291 TEST_F(IPCAttachmentBrokerPrivilegedWinTest, DISABLED_SendHandle) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 SendControlMessage(sender, success); | 553 SendControlMessage(sender, success); |
| 553 } | 554 } |
| 554 } | 555 } |
| 555 | 556 |
| 556 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleTwice) { | 557 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleTwice) { |
| 557 return CommonPrivilegedProcessMain(&SendHandleTwiceCallback, | 558 return CommonPrivilegedProcessMain(&SendHandleTwiceCallback, |
| 558 "SendHandleTwice"); | 559 "SendHandleTwice"); |
| 559 } | 560 } |
| 560 | 561 |
| 561 } // namespace | 562 } // namespace |
| OLD | NEW |