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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_test_utils.h

Issue 1354363002: Cleanup: Pass std::string as const reference from content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "content/common/p2p_messages.h" 10 #include "content/common/p2p_messages.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 net::IPEndPoint local_address_; 88 net::IPEndPoint local_address_;
89 89
90 net::BoundNetLog net_log_; 90 net::BoundNetLog net_log_;
91 }; 91 };
92 92
93 void CreateRandomPacket(std::vector<char>* packet); 93 void CreateRandomPacket(std::vector<char>* packet);
94 void CreateStunRequest(std::vector<char>* packet); 94 void CreateStunRequest(std::vector<char>* packet);
95 void CreateStunResponse(std::vector<char>* packet); 95 void CreateStunResponse(std::vector<char>* packet);
96 void CreateStunError(std::vector<char>* packet); 96 void CreateStunError(std::vector<char>* packet);
97 97
98 net::IPEndPoint ParseAddress(const std::string ip_str, uint16 port); 98 net::IPEndPoint ParseAddress(const std::string& ip_str, uint16 port);
99 99
100 MATCHER_P(MatchMessage, type, "") { 100 MATCHER_P(MatchMessage, type, "") {
101 return arg->type() == type; 101 return arg->type() == type;
102 } 102 }
103 103
104 MATCHER_P(MatchPacketMessage, packet_content, "") { 104 MATCHER_P(MatchPacketMessage, packet_content, "") {
105 if (arg->type() != P2PMsg_OnDataReceived::ID) 105 if (arg->type() != P2PMsg_OnDataReceived::ID)
106 return false; 106 return false;
107 P2PMsg_OnDataReceived::Param params; 107 P2PMsg_OnDataReceived::Param params;
108 P2PMsg_OnDataReceived::Read(arg, &params); 108 P2PMsg_OnDataReceived::Read(arg, &params);
109 return base::get<2>(params) == packet_content; 109 return base::get<2>(params) == packet_content;
110 } 110 }
111 111
112 MATCHER_P(MatchIncomingSocketMessage, address, "") { 112 MATCHER_P(MatchIncomingSocketMessage, address, "") {
113 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID) 113 if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID)
114 return false; 114 return false;
115 P2PMsg_OnIncomingTcpConnection::Param params; 115 P2PMsg_OnIncomingTcpConnection::Param params;
116 P2PMsg_OnIncomingTcpConnection::Read( 116 P2PMsg_OnIncomingTcpConnection::Read(
117 arg, &params); 117 arg, &params);
118 return base::get<1>(params) == address; 118 return base::get<1>(params) == address;
119 } 119 }
120 120
121 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_ 121 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698