| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "sandbox/win/src/crosscall_client.h" | 6 #include "sandbox/win/src/crosscall_client.h" |
| 7 #include "sandbox/win/src/crosscall_server.h" | 7 #include "sandbox/win/src/crosscall_server.h" |
| 8 #include "sandbox/win/src/sharedmem_ipc_client.h" | 8 #include "sandbox/win/src/sharedmem_ipc_client.h" |
| 9 #include "sandbox/win/src/sharedmem_ipc_server.h" | 9 #include "sandbox/win/src/sharedmem_ipc_server.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 CrossCallReturn answer; | 609 CrossCallReturn answer; |
| 610 HANDLE bar = HANDLE(191919); | 610 HANDLE bar = HANDLE(191919); |
| 611 DWORD foo = 6767676; | 611 DWORD foo = 6767676; |
| 612 CrossCall(client, UnitTestIPCDispatcher::CALL_ONE_TAG, bar, foo, &answer); | 612 CrossCall(client, UnitTestIPCDispatcher::CALL_ONE_TAG, bar, foo, &answer); |
| 613 void* buff = client.GetBuffer(); | 613 void* buff = client.GetBuffer(); |
| 614 ASSERT_TRUE(NULL != buff); | 614 ASSERT_TRUE(NULL != buff); |
| 615 | 615 |
| 616 UnitTestIPCDispatcher dispatcher; | 616 UnitTestIPCDispatcher dispatcher; |
| 617 // Since we are directly calling InvokeCallback, most of this structure | 617 // Since we are directly calling InvokeCallback, most of this structure |
| 618 // can be set to NULL. | 618 // can be set to NULL. |
| 619 sandbox::SharedMemIPCServer::ServerControl srv_control = { | 619 sandbox::SharedMemIPCServer::ServerControl srv_control = {}; |
| 620 NULL, NULL, kIPCChannelSize, NULL, | 620 srv_control.channel_size = kIPCChannelSize; |
| 621 reinterpret_cast<char*>(client_control), | 621 srv_control.shared_base = reinterpret_cast<char*>(client_control); |
| 622 NULL, &dispatcher, {0} }; | 622 srv_control.dispatcher = &dispatcher; |
| 623 | 623 |
| 624 sandbox::CrossCallReturn call_return = {0}; | 624 sandbox::CrossCallReturn call_return = {0}; |
| 625 EXPECT_TRUE(SharedMemIPCServer::InvokeCallback(&srv_control, buff, | 625 EXPECT_TRUE(SharedMemIPCServer::InvokeCallback(&srv_control, buff, |
| 626 &call_return)); | 626 &call_return)); |
| 627 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); | 627 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); |
| 628 EXPECT_TRUE(bar == call_return.extended[0].handle); | 628 EXPECT_TRUE(bar == call_return.extended[0].handle); |
| 629 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); | 629 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); |
| 630 | 630 |
| 631 CloseChannelEvents(client_control); | 631 CloseChannelEvents(client_control); |
| 632 delete[] reinterpret_cast<char*>(client_control); | 632 delete[] reinterpret_cast<char*>(client_control); |
| 633 } | 633 } |
| 634 | 634 |
| 635 } // namespace sandbox | 635 } // namespace sandbox |
| OLD | NEW |