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

Side by Side Diff: ipc/ipc_sync_message_unittest.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | « ipc/ipc_sync_channel_unittest.cc ('k') | ipc/ipc_tests.cc » ('j') | 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-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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 *out4 = false; 101 *out4 = false;
102 } 102 }
103 103
104 bool Send(IPC::Message* message) { 104 bool Send(IPC::Message* message) {
105 // gets the reply message, stash in global 105 // gets the reply message, stash in global
106 DCHECK(g_reply == NULL); 106 DCHECK(g_reply == NULL);
107 g_reply = message; 107 g_reply = message;
108 return true; 108 return true;
109 } 109 }
110 110
111 void OnMessageReceived(const IPC::Message& msg) { 111 bool OnMessageReceived(const IPC::Message& msg) {
112 IPC_BEGIN_MESSAGE_MAP(TestMessageReceiver, msg) 112 IPC_BEGIN_MESSAGE_MAP(TestMessageReceiver, msg)
113 IPC_MESSAGE_HANDLER(Msg_C_0_1, On_0_1) 113 IPC_MESSAGE_HANDLER(Msg_C_0_1, On_0_1)
114 IPC_MESSAGE_HANDLER(Msg_C_0_2, On_0_2) 114 IPC_MESSAGE_HANDLER(Msg_C_0_2, On_0_2)
115 IPC_MESSAGE_HANDLER(Msg_C_0_3, On_0_3) 115 IPC_MESSAGE_HANDLER(Msg_C_0_3, On_0_3)
116 IPC_MESSAGE_HANDLER(Msg_C_1_1, On_1_1) 116 IPC_MESSAGE_HANDLER(Msg_C_1_1, On_1_1)
117 IPC_MESSAGE_HANDLER(Msg_C_1_2, On_1_2) 117 IPC_MESSAGE_HANDLER(Msg_C_1_2, On_1_2)
118 IPC_MESSAGE_HANDLER(Msg_C_1_3, On_1_3) 118 IPC_MESSAGE_HANDLER(Msg_C_1_3, On_1_3)
119 IPC_MESSAGE_HANDLER(Msg_C_2_1, On_2_1) 119 IPC_MESSAGE_HANDLER(Msg_C_2_1, On_2_1)
120 IPC_MESSAGE_HANDLER(Msg_C_2_2, On_2_2) 120 IPC_MESSAGE_HANDLER(Msg_C_2_2, On_2_2)
121 IPC_MESSAGE_HANDLER(Msg_C_2_3, On_2_3) 121 IPC_MESSAGE_HANDLER(Msg_C_2_3, On_2_3)
122 IPC_MESSAGE_HANDLER(Msg_C_3_1, On_3_1) 122 IPC_MESSAGE_HANDLER(Msg_C_3_1, On_3_1)
123 IPC_MESSAGE_HANDLER(Msg_C_3_2, On_3_2) 123 IPC_MESSAGE_HANDLER(Msg_C_3_2, On_3_2)
124 IPC_MESSAGE_HANDLER(Msg_C_3_3, On_3_3) 124 IPC_MESSAGE_HANDLER(Msg_C_3_3, On_3_3)
125 IPC_MESSAGE_HANDLER(Msg_C_3_4, On_3_4) 125 IPC_MESSAGE_HANDLER(Msg_C_3_4, On_3_4)
126 IPC_MESSAGE_HANDLER(Msg_R_0_1, On_0_1) 126 IPC_MESSAGE_HANDLER(Msg_R_0_1, On_0_1)
127 IPC_MESSAGE_HANDLER(Msg_R_0_2, On_0_2) 127 IPC_MESSAGE_HANDLER(Msg_R_0_2, On_0_2)
128 IPC_MESSAGE_HANDLER(Msg_R_0_3, On_0_3) 128 IPC_MESSAGE_HANDLER(Msg_R_0_3, On_0_3)
129 IPC_MESSAGE_HANDLER(Msg_R_1_1, On_1_1) 129 IPC_MESSAGE_HANDLER(Msg_R_1_1, On_1_1)
130 IPC_MESSAGE_HANDLER(Msg_R_1_2, On_1_2) 130 IPC_MESSAGE_HANDLER(Msg_R_1_2, On_1_2)
131 IPC_MESSAGE_HANDLER(Msg_R_1_3, On_1_3) 131 IPC_MESSAGE_HANDLER(Msg_R_1_3, On_1_3)
132 IPC_MESSAGE_HANDLER(Msg_R_2_1, On_2_1) 132 IPC_MESSAGE_HANDLER(Msg_R_2_1, On_2_1)
133 IPC_MESSAGE_HANDLER(Msg_R_2_2, On_2_2) 133 IPC_MESSAGE_HANDLER(Msg_R_2_2, On_2_2)
134 IPC_MESSAGE_HANDLER(Msg_R_2_3, On_2_3) 134 IPC_MESSAGE_HANDLER(Msg_R_2_3, On_2_3)
135 IPC_MESSAGE_HANDLER(Msg_R_3_1, On_3_1) 135 IPC_MESSAGE_HANDLER(Msg_R_3_1, On_3_1)
136 IPC_MESSAGE_HANDLER(Msg_R_3_2, On_3_2) 136 IPC_MESSAGE_HANDLER(Msg_R_3_2, On_3_2)
137 IPC_MESSAGE_HANDLER(Msg_R_3_3, On_3_3) 137 IPC_MESSAGE_HANDLER(Msg_R_3_3, On_3_3)
138 IPC_MESSAGE_HANDLER(Msg_R_3_4, On_3_4) 138 IPC_MESSAGE_HANDLER(Msg_R_3_4, On_3_4)
139 IPC_END_MESSAGE_MAP() 139 IPC_END_MESSAGE_MAP()
140 return true;
140 } 141 }
141 142
142 }; 143 };
143 144
144 void Send(IPC::SyncMessage* msg) { 145 void Send(IPC::SyncMessage* msg) {
145 static TestMessageReceiver receiver; 146 static TestMessageReceiver receiver;
146 147
147 IPC::MessageReplyDeserializer* reply_serializer = msg->GetReplyDeserializer(); 148 IPC::MessageReplyDeserializer* reply_serializer = msg->GetReplyDeserializer();
148 DCHECK(reply_serializer != NULL); 149 DCHECK(reply_serializer != NULL);
149 150
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 DCHECK(bool1); 256 DCHECK(bool1);
256 257
257 bool1 = false; 258 bool1 = false;
258 Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); 259 Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1));
259 DCHECK(bool1 && int1 == 32); 260 DCHECK(bool1 && int1 == 32);
260 261
261 bool1 = true; 262 bool1 = true;
262 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); 263 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1));
263 DCHECK(string1 == "3_3" && int1 == 33 && !bool1); 264 DCHECK(string1 == "3_3" && int1 == 33 && !bool1);
264 } 265 }
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel_unittest.cc ('k') | ipc/ipc_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698