Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/proxy/ppapi_proxy_test.h" | 5 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 IPC::PlatformFileForTransit | 249 IPC::PlatformFileForTransit |
| 250 PluginProxyTestHarness::PluginDelegateMock::ShareHandleWithRemote( | 250 PluginProxyTestHarness::PluginDelegateMock::ShareHandleWithRemote( |
| 251 base::PlatformFile handle, | 251 base::PlatformFile handle, |
| 252 base::ProcessId /* remote_pid */, | 252 base::ProcessId /* remote_pid */, |
| 253 bool should_close_source) { | 253 bool should_close_source) { |
| 254 return IPC::GetFileHandleForProcess(handle, | 254 return IPC::GetFileHandleForProcess(handle, |
| 255 base::GetCurrentProcessHandle(), | 255 base::GetCurrentProcessHandle(), |
| 256 should_close_source); | 256 should_close_source); |
| 257 } | 257 } |
| 258 | 258 |
| 259 base::SharedMemoryHandle | |
| 260 PluginProxyTestHarness::PluginDelegateMock::ShareSharedMemoryHandleWithRemote( | |
| 261 const base::SharedMemoryHandle& handle, | |
| 262 base::ProcessId remote_pid) { | |
| 263 #if defined(OS_POSIX) | |
| 264 return ShareHandleWithRemote(handle.fd, remote_pid, false); | |
| 265 #elif defined(OS_WIN) | |
| 266 return ShareHandleWithRemote( | |
| 267 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)), remote_pid, | |
|
piman
2015/06/01 22:16:08
ditto, no need for casts.
erikchen
2015/06/01 23:48:53
Done.
| |
| 268 false); | |
| 269 #else | |
| 270 #error Not implemented. | |
| 271 #endif | |
| 272 } | |
| 273 | |
| 259 std::set<PP_Instance>* | 274 std::set<PP_Instance>* |
| 260 PluginProxyTestHarness::PluginDelegateMock::GetGloballySeenInstanceIDSet() { | 275 PluginProxyTestHarness::PluginDelegateMock::GetGloballySeenInstanceIDSet() { |
| 261 return &instance_id_set_; | 276 return &instance_id_set_; |
| 262 } | 277 } |
| 263 | 278 |
| 264 uint32 PluginProxyTestHarness::PluginDelegateMock::Register( | 279 uint32 PluginProxyTestHarness::PluginDelegateMock::Register( |
| 265 PluginDispatcher* plugin_dispatcher) { | 280 PluginDispatcher* plugin_dispatcher) { |
| 266 return 0; | 281 return 0; |
| 267 } | 282 } |
| 268 | 283 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 IPC::PlatformFileForTransit | 497 IPC::PlatformFileForTransit |
| 483 HostProxyTestHarness::DelegateMock::ShareHandleWithRemote( | 498 HostProxyTestHarness::DelegateMock::ShareHandleWithRemote( |
| 484 base::PlatformFile handle, | 499 base::PlatformFile handle, |
| 485 base::ProcessId /* remote_pid */, | 500 base::ProcessId /* remote_pid */, |
| 486 bool should_close_source) { | 501 bool should_close_source) { |
| 487 return IPC::GetFileHandleForProcess(handle, | 502 return IPC::GetFileHandleForProcess(handle, |
| 488 base::GetCurrentProcessHandle(), | 503 base::GetCurrentProcessHandle(), |
| 489 should_close_source); | 504 should_close_source); |
| 490 } | 505 } |
| 491 | 506 |
| 507 base::SharedMemoryHandle | |
| 508 HostProxyTestHarness::DelegateMock::ShareSharedMemoryHandleWithRemote( | |
| 509 const base::SharedMemoryHandle& handle, | |
| 510 base::ProcessId remote_pid) { | |
| 511 #if defined(OS_POSIX) | |
| 512 return ShareHandleWithRemote(handle.fd, remote_pid, false); | |
| 513 #elif defined(OS_WIN) | |
| 514 return ShareHandleWithRemote( | |
| 515 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)), remote_pid, | |
|
piman
2015/06/01 22:16:08
ditto
erikchen
2015/06/01 23:48:53
Done.
| |
| 516 false); | |
| 517 #else | |
| 518 #error Not implemented. | |
| 519 #endif | |
| 520 } | |
| 492 | 521 |
| 493 // HostProxyTest --------------------------------------------------------------- | 522 // HostProxyTest --------------------------------------------------------------- |
| 494 | 523 |
| 495 HostProxyTest::HostProxyTest() : HostProxyTestHarness(SINGLETON_GLOBALS) { | 524 HostProxyTest::HostProxyTest() : HostProxyTestHarness(SINGLETON_GLOBALS) { |
| 496 } | 525 } |
| 497 | 526 |
| 498 HostProxyTest::~HostProxyTest() { | 527 HostProxyTest::~HostProxyTest() { |
| 499 } | 528 } |
| 500 | 529 |
| 501 void HostProxyTest::SetUp() { | 530 void HostProxyTest::SetUp() { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, | 606 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, |
| 578 base::Bind(&RunTaskOnRemoteHarness, | 607 base::Bind(&RunTaskOnRemoteHarness, |
| 579 task, | 608 task, |
| 580 &task_complete)); | 609 &task_complete)); |
| 581 task_complete.Wait(); | 610 task_complete.Wait(); |
| 582 } | 611 } |
| 583 | 612 |
| 584 | 613 |
| 585 } // namespace proxy | 614 } // namespace proxy |
| 586 } // namespace ppapi | 615 } // namespace ppapi |
| OLD | NEW |