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

Side by Side Diff: ipc/ipc_sync_message_unittest.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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
OLDNEW
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 "base/logging.h" 9 #include "base/logging.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 void On_2_3(int in1, bool in2, std::string* out1, int* out2, bool* out3) { 70 void On_2_3(int in1, bool in2, std::string* out1, int* out2, bool* out3) {
71 DCHECK_EQ(3, in1); 71 DCHECK_EQ(3, in1);
72 DCHECK(in2); 72 DCHECK(in2);
73 *out1 = "2_3"; 73 *out1 = "2_3";
74 *out2 = 23; 74 *out2 = 23;
75 *out3 = false; 75 *out3 = false;
76 } 76 }
77 77
78 void On_3_1(int in1, bool in2, std::string in3, bool* out1) { 78 void On_3_1(int in1, bool in2, const std::string& in3, bool* out1) {
79 DCHECK_EQ(1, in1); 79 DCHECK_EQ(1, in1);
80 DCHECK(!in2); 80 DCHECK(!in2);
81 DCHECK_EQ("3_1", in3); 81 DCHECK_EQ("3_1", in3);
82 *out1 = true; 82 *out1 = true;
83 } 83 }
84 84
85 void On_3_2(std::string in1, bool in2, int in3, bool* out1, int* out2) { 85 void On_3_2(const std::string& in1,
86 bool in2,
87 int in3,
88 bool* out1,
89 int* out2) {
86 DCHECK_EQ("3_2", in1); 90 DCHECK_EQ("3_2", in1);
87 DCHECK(!in2); 91 DCHECK(!in2);
88 DCHECK_EQ(2, in3); 92 DCHECK_EQ(2, in3);
89 *out1 = true; 93 *out1 = true;
90 *out2 = 32; 94 *out2 = 32;
91 } 95 }
92 96
93 void On_3_3(int in1, std::string in2, bool in3, std::string* out1, int* out2, 97 void On_3_3(int in1,
98 const std::string& in2,
99 bool in3,
100 std::string* out1,
101 int* out2,
94 bool* out3) { 102 bool* out3) {
95 DCHECK_EQ(3, in1); 103 DCHECK_EQ(3, in1);
96 DCHECK_EQ("3_3", in2); 104 DCHECK_EQ("3_3", in2);
97 DCHECK(in3); 105 DCHECK(in3);
98 *out1 = "3_3"; 106 *out1 = "3_3";
99 *out2 = 33; 107 *out2 = 33;
100 *out3 = false; 108 *out3 = false;
101 } 109 }
102 110
103 void On_3_4(bool in1, int in2, std::string in3, int* out1, bool* out2, 111 void On_3_4(bool in1,
104 std::string* out3, bool* out4) { 112 int in2,
113 const std::string& in3,
114 int* out1,
115 bool* out2,
116 std::string* out3,
117 bool* out4) {
105 DCHECK(in1); 118 DCHECK(in1);
106 DCHECK_EQ(3, in2); 119 DCHECK_EQ(3, in2);
107 DCHECK_EQ("3_4", in3); 120 DCHECK_EQ("3_4", in3);
108 *out1 = 34; 121 *out1 = 34;
109 *out2 = true; 122 *out2 = true;
110 *out3 = "3_4"; 123 *out3 = "3_4";
111 *out4 = false; 124 *out4 = false;
112 } 125 }
113 126
114 bool Send(IPC::Message* message) { 127 bool Send(IPC::Message* message) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 DCHECK_EQ(32, int1); 308 DCHECK_EQ(32, int1);
296 309
297 bool1 = true; 310 bool1 = true;
298 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); 311 Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1));
299 DCHECK_EQ("3_3", string1); 312 DCHECK_EQ("3_3", string1);
300 DCHECK_EQ(33, int1); 313 DCHECK_EQ(33, int1);
301 DCHECK(!bool1); 314 DCHECK(!bool1);
302 } 315 }
303 316
304 } // namespace 317 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698