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

Side by Side Diff: remoting/protocol/protocol_mock_objects.h

Issue 17063003: Changes to PairingRegistry to facilitate per-platform implementions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback. Created 7 years, 6 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 | Annotate | Revision Log
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 REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 public: 180 public:
181 MockSessionManager(); 181 MockSessionManager();
182 virtual ~MockSessionManager(); 182 virtual ~MockSessionManager();
183 183
184 MOCK_METHOD2(Init, void(SignalStrategy*, Listener*)); 184 MOCK_METHOD2(Init, void(SignalStrategy*, Listener*));
185 MOCK_METHOD3(ConnectPtr, Session*( 185 MOCK_METHOD3(ConnectPtr, Session*(
186 const std::string& host_jid, 186 const std::string& host_jid,
187 Authenticator* authenticator, 187 Authenticator* authenticator,
188 CandidateSessionConfig* config)); 188 CandidateSessionConfig* config));
189 MOCK_METHOD0(Close, void()); 189 MOCK_METHOD0(Close, void());
190 MOCK_METHOD1(set_authenticator_factory_ptr, void(AuthenticatorFactory*)); 190 MOCK_METHOD1(set_authenticator_factory_ptr,
191 void(AuthenticatorFactory* factory));
191 virtual scoped_ptr<Session> Connect( 192 virtual scoped_ptr<Session> Connect(
192 const std::string& host_jid, 193 const std::string& host_jid,
193 scoped_ptr<Authenticator> authenticator, 194 scoped_ptr<Authenticator> authenticator,
194 scoped_ptr<CandidateSessionConfig> config) { 195 scoped_ptr<CandidateSessionConfig> config) {
195 return scoped_ptr<Session>(ConnectPtr( 196 return scoped_ptr<Session>(ConnectPtr(
196 host_jid, authenticator.get(), config.get())); 197 host_jid, authenticator.get(), config.get()));
197 }; 198 }
198 virtual void set_authenticator_factory( 199 virtual void set_authenticator_factory(
199 scoped_ptr<AuthenticatorFactory> authenticator_factory) { 200 scoped_ptr<AuthenticatorFactory> authenticator_factory) {
200 set_authenticator_factory_ptr(authenticator_factory.release()); 201 set_authenticator_factory_ptr(authenticator_factory.release());
201 }; 202 }
202 203
203 private: 204 private:
204 DISALLOW_COPY_AND_ASSIGN(MockSessionManager); 205 DISALLOW_COPY_AND_ASSIGN(MockSessionManager);
205 }; 206 };
206 207
207 // Simple delegate that caches information on paired clients in memory. 208 // Simple delegate that caches information on paired clients in memory.
208 class MockPairingRegistryDelegate : public PairingRegistry::Delegate { 209 class MockPairingRegistryDelegate : public PairingRegistry::Delegate {
209 public: 210 public:
210 MockPairingRegistryDelegate(); 211 MockPairingRegistryDelegate();
211 virtual ~MockPairingRegistryDelegate(); 212 virtual ~MockPairingRegistryDelegate();
212 213
213 const PairingRegistry::PairedClients& paired_clients() const { 214 const PairingRegistry::PairedClients& paired_clients() const {
214 return paired_clients_; 215 return paired_clients_;
215 } 216 }
216 217
217 // PairingRegistry::Delegate implementation. 218 // PairingRegistry::Delegate implementation.
218 virtual void AddPairing( 219 virtual void AddPairing(
219 const PairingRegistry::Pairing& new_paired_client) OVERRIDE; 220 const PairingRegistry::Pairing& new_paired_client,
221 const PairingRegistry::AddPairingCallback& callback) OVERRIDE;
220 virtual void GetPairing( 222 virtual void GetPairing(
221 const std::string& client_id, 223 const std::string& client_id,
222 const PairingRegistry::GetPairingCallback& callback) OVERRIDE; 224 const PairingRegistry::GetPairingCallback& callback) OVERRIDE;
223 225
224 void RunCallback(); 226 void RunCallback();
225 227
226 private: 228 private:
227 base::Closure saved_callback_; 229 base::Closure saved_callback_;
228 PairingRegistry::PairedClients paired_clients_; 230 PairingRegistry::PairedClients paired_clients_;
229 }; 231 };
230 232
231 } // namespace protocol 233 } // namespace protocol
232 } // namespace remoting 234 } // namespace remoting
233 235
234 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 236 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
OLDNEW
« no previous file with comments | « remoting/protocol/pairing_registry_unittest.cc ('k') | remoting/protocol/protocol_mock_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698