Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1500)

Side by Side Diff: sandbox/src/ipc_unittest.cc

Issue 3142022: Sbox IPC fix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/src/crosscall_server.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/src/crosscall_client.h" 6 #include "sandbox/src/crosscall_client.h"
7 #include "sandbox/src/crosscall_server.h" 7 #include "sandbox/src/crosscall_server.h"
8 #include "sandbox/src/sharedmem_ipc_client.h" 8 #include "sandbox/src/sharedmem_ipc_client.h"
9 #include "sandbox/src/sharedmem_ipc_server.h" 9 #include "sandbox/src/sharedmem_ipc_server.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 params_2.CopyParamIn(0, &value, sizeof(value), false, ULONG_TYPE); 325 params_2.CopyParamIn(0, &value, sizeof(value), false, ULONG_TYPE);
326 buffer = const_cast<void*>(params_2.GetBuffer()); 326 buffer = const_cast<void*>(params_2.GetBuffer());
327 327
328 EXPECT_TRUE(NULL != buffer); 328 EXPECT_TRUE(NULL != buffer);
329 ccp = CrossCallParamsEx::CreateFromBuffer(buffer, params_2.GetSize(), 329 ccp = CrossCallParamsEx::CreateFromBuffer(buffer, params_2.GetSize(),
330 &out_size); 330 &out_size);
331 // If the buffer is malformed the return is NULL. 331 // If the buffer is malformed the return is NULL.
332 EXPECT_TRUE(NULL == ccp); 332 EXPECT_TRUE(NULL == ccp);
333 } 333 }
334 #endif // defined(NDEBUG) 334 #endif // defined(NDEBUG)
335
336 ActualCallParams<1, 256> params_3(kTag, 1);
337 params_3.CopyParamIn(0, &value, sizeof(value), false, ULONG_TYPE);
338 buffer = const_cast<void*>(params_3.GetBuffer());
339 EXPECT_TRUE(NULL != buffer);
340
341 size_t correct_size = params_3.OverrideSize(1);
342 ccp = CrossCallParamsEx::CreateFromBuffer(buffer, 256, &out_size);
343 EXPECT_TRUE(NULL == ccp);
344
345 params_3.OverrideSize(correct_size - 4);
346 ccp = CrossCallParamsEx::CreateFromBuffer(buffer, 256, &out_size);
347 EXPECT_TRUE(NULL == ccp);
348
349 params_3.OverrideSize(correct_size);
350 ccp = CrossCallParamsEx::CreateFromBuffer(buffer, 256, &out_size);
351 EXPECT_TRUE(NULL != ccp);
335 } 352 }
336 353
337 // This structure is passed to the mock server threads to simulate 354 // This structure is passed to the mock server threads to simulate
338 // the server side IPC so it has the required kernel objects. 355 // the server side IPC so it has the required kernel objects.
339 struct ServerEvents { 356 struct ServerEvents {
340 HANDLE ping; 357 HANDLE ping;
341 HANDLE pong; 358 HANDLE pong;
342 volatile LONG* state; 359 volatile LONG* state;
343 HANDLE mutex; 360 HANDLE mutex;
344 }; 361 };
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 &call_return)); 613 &call_return));
597 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); 614 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome);
598 EXPECT_TRUE(bar == call_return.extended[0].handle); 615 EXPECT_TRUE(bar == call_return.extended[0].handle);
599 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); 616 EXPECT_EQ(foo, call_return.extended[1].unsigned_int);
600 617
601 CloseChannelEvents(client_control); 618 CloseChannelEvents(client_control);
602 delete[] reinterpret_cast<char*>(client_control); 619 delete[] reinterpret_cast<char*>(client_control);
603 } 620 }
604 621
605 } // namespace sandbox 622 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/crosscall_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698