OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 DCHECK(in1 == 1 && !in2 && in3 == "3_1"); | 78 DCHECK(in1 == 1 && !in2 && in3 == "3_1"); |
79 *out1 = true; | 79 *out1 = true; |
80 } | 80 } |
81 | 81 |
82 void On_3_2(std::string in1, bool in2, int in3, bool* out1, int* out2) { | 82 void On_3_2(std::string in1, bool in2, int in3, bool* out1, int* out2) { |
83 DCHECK(in1 == "3_2" && !in2 && in3 == 2); | 83 DCHECK(in1 == "3_2" && !in2 && in3 == 2); |
84 *out1 = true; | 84 *out1 = true; |
85 *out2 = 32; | 85 *out2 = 32; |
86 } | 86 } |
87 | 87 |
88 void On_3_3(int in1, std::string in2, bool in3, std::string* out1, int* out2,
bool* out3) { | 88 void On_3_3(int in1, std::string in2, bool in3, std::string* out1, int* out2, |
| 89 bool* out3) { |
89 DCHECK(in1 == 3 && in2 == "3_3" && in3); | 90 DCHECK(in1 == 3 && in2 == "3_3" && in3); |
90 *out1 = "3_3"; | 91 *out1 = "3_3"; |
91 *out2 = 33; | 92 *out2 = 33; |
92 *out3 = false; | 93 *out3 = false; |
93 } | 94 } |
94 | 95 |
95 bool Send(IPC::Message* message) { | 96 bool Send(IPC::Message* message) { |
96 // gets the reply message, stash in global | 97 // gets the reply message, stash in global |
97 DCHECK(g_reply == NULL); | 98 DCHECK(g_reply == NULL); |
98 g_reply = message; | 99 g_reply = message; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 241 |
241 bool1 = false; | 242 bool1 = false; |
242 Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); | 243 Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); |
243 DCHECK(bool1 && int1 == 32); | 244 DCHECK(bool1 && int1 == 32); |
244 | 245 |
245 bool1 = true; | 246 bool1 = true; |
246 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); | 247 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); |
247 DCHECK(string1 == "3_3" && int1 == 33 && !bool1); | 248 DCHECK(string1 == "3_3" && int1 == 33 && !bool1); |
248 } | 249 } |
249 | 250 |
OLD | NEW |