OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Unit test to make sure that the serialization of synchronous IPC messages | 5 // Unit test to make sure that the serialization of synchronous IPC messages |
6 // works. This ensures that the macros and templates were defined correctly. | 6 // works. This ensures that the macros and templates were defined correctly. |
7 // Doesn't test the IPC channel mechanism. | 7 // Doesn't test the IPC channel mechanism. |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
13 #include "ipc/ipc_message_utils.h" | 13 #include "ipc/ipc_message_utils.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 #define IPC_MESSAGE_IMPL | 17 #define IPC_MESSAGE_IMPL |
18 #include "ipc/ipc_sync_message_unittest.h" | 18 #include "ipc/ipc_sync_message_unittest.h" |
19 | 19 |
| 20 namespace { |
| 21 |
20 static IPC::Message* g_reply; | 22 static IPC::Message* g_reply; |
21 | 23 |
22 class TestMessageReceiver { | 24 class TestMessageReceiver { |
23 public: | 25 public: |
24 | 26 |
25 void On_0_1(bool* out1) { | 27 void On_0_1(bool* out1) { |
26 *out1 = false; | 28 *out1 = false; |
27 } | 29 } |
28 | 30 |
29 void On_0_2(bool* out1, int* out2) { | 31 void On_0_2(bool* out1, int* out2) { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); | 296 Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); |
295 DCHECK(bool1); | 297 DCHECK(bool1); |
296 DCHECK_EQ(32, int1); | 298 DCHECK_EQ(32, int1); |
297 | 299 |
298 bool1 = true; | 300 bool1 = true; |
299 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); | 301 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); |
300 DCHECK_EQ("3_3", string1); | 302 DCHECK_EQ("3_3", string1); |
301 DCHECK_EQ(33, int1); | 303 DCHECK_EQ(33, int1); |
302 DCHECK(!bool1); | 304 DCHECK(!bool1); |
303 } | 305 } |
| 306 |
| 307 } // namespace |
OLD | NEW |