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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 ::InterlockedExchange(events->state, kAckChannel); | 385 ::InterlockedExchange(events->state, kAckChannel); |
386 ::SetEvent(events->pong); | 386 ::SetEvent(events->pong); |
387 return wait_result; | 387 return wait_result; |
388 } | 388 } |
389 | 389 |
390 class CrossCallParamsMock : public CrossCallParams { | 390 class CrossCallParamsMock : public CrossCallParams { |
391 public: | 391 public: |
392 CrossCallParamsMock(uint32 tag, uint32 params_count) | 392 CrossCallParamsMock(uint32 tag, uint32 params_count) |
393 : CrossCallParams(tag, params_count) { | 393 : CrossCallParams(tag, params_count) { |
394 } | 394 } |
395 private: | |
396 void* params[4]; | |
397 }; | 395 }; |
398 | 396 |
399 void FakeOkAnswerInChannel(void* channel) { | 397 void FakeOkAnswerInChannel(void* channel) { |
400 CrossCallReturn* answer = reinterpret_cast<CrossCallReturn*>(channel); | 398 CrossCallReturn* answer = reinterpret_cast<CrossCallReturn*>(channel); |
401 answer->call_outcome = SBOX_ALL_OK; | 399 answer->call_outcome = SBOX_ALL_OK; |
402 } | 400 } |
403 | 401 |
404 // Create two threads that will quickly answer IPCs; the first one | 402 // Create two threads that will quickly answer IPCs; the first one |
405 // using channel 1 (channel 0 is busy) and one using channel 0. No time-out | 403 // using channel 1 (channel 0 is busy) and one using channel 0. No time-out |
406 // should occur. | 404 // should occur. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 &call_return)); | 624 &call_return)); |
627 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); | 625 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); |
628 EXPECT_TRUE(bar == call_return.extended[0].handle); | 626 EXPECT_TRUE(bar == call_return.extended[0].handle); |
629 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); | 627 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); |
630 | 628 |
631 CloseChannelEvents(client_control); | 629 CloseChannelEvents(client_control); |
632 delete[] reinterpret_cast<char*>(client_control); | 630 delete[] reinterpret_cast<char*>(client_control); |
633 } | 631 } |
634 | 632 |
635 } // namespace sandbox | 633 } // namespace sandbox |
OLD | NEW |