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

Side by Side Diff: remoting/host/host_mock_objects.h

Issue 138753005: Add gnubby authentication to remoting host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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 REMOTING_HOST_HOST_MOCK_OBJECTS_H_ 5 #ifndef REMOTING_HOST_HOST_MOCK_OBJECTS_H_
6 #define REMOTING_HOST_HOST_MOCK_OBJECTS_H_ 6 #define REMOTING_HOST_HOST_MOCK_OBJECTS_H_
7 7
8 #include <string>
9
8 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
9 #include "remoting/host/chromoting_host_context.h" 11 #include "remoting/host/chromoting_host_context.h"
10 #include "remoting/host/client_session.h" 12 #include "remoting/host/client_session.h"
11 #include "remoting/host/client_session_control.h" 13 #include "remoting/host/client_session_control.h"
12 #include "remoting/host/desktop_environment.h" 14 #include "remoting/host/desktop_environment.h"
15 #include "remoting/host/gnubby_auth_handler.h"
16 #include "remoting/host/gnubby_connection.h"
17 #include "remoting/host/gnubby_connection_factory.h"
13 #include "remoting/host/host_status_observer.h" 18 #include "remoting/host/host_status_observer.h"
14 #include "remoting/host/input_injector.h" 19 #include "remoting/host/input_injector.h"
15 #include "remoting/host/screen_controls.h" 20 #include "remoting/host/screen_controls.h"
16 #include "remoting/host/screen_resolution.h" 21 #include "remoting/host/screen_resolution.h"
17 #include "remoting/proto/control.pb.h" 22 #include "remoting/proto/control.pb.h"
18 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
19 24
20 namespace base { 25 namespace base {
21 class SingleThreadTaskRunner; 26 class SingleThreadTaskRunner;
22 } // namespace base 27 } // namespace base
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 MOCK_METHOD1(OnClientConnected, void(const std::string& jid)); 124 MOCK_METHOD1(OnClientConnected, void(const std::string& jid));
120 MOCK_METHOD1(OnClientDisconnected, void(const std::string& jid)); 125 MOCK_METHOD1(OnClientDisconnected, void(const std::string& jid));
121 MOCK_METHOD3(OnClientRouteChange, 126 MOCK_METHOD3(OnClientRouteChange,
122 void(const std::string& jid, 127 void(const std::string& jid,
123 const std::string& channel_name, 128 const std::string& channel_name,
124 const protocol::TransportRoute& route)); 129 const protocol::TransportRoute& route));
125 MOCK_METHOD1(OnStart, void(const std::string& xmpp_login)); 130 MOCK_METHOD1(OnStart, void(const std::string& xmpp_login));
126 MOCK_METHOD0(OnShutdown, void()); 131 MOCK_METHOD0(OnShutdown, void());
127 }; 132 };
128 133
134 class MockGnubbyAuthHandler : public GnubbyAuthHandler {
135 public:
136 MockGnubbyAuthHandler(
137 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
138 GnubbyConnectionFactory* gnubby_connection_factory,
139 protocol::ClientStub* client_stub);
140 virtual ~MockGnubbyAuthHandler();
141
142 MOCK_METHOD1(DeliverClientMessage, void(const std::string message));
143 MOCK_METHOD1(ConnectionClosed, void(int connection_id));
144 MOCK_METHOD2(ConnectionError, void(int connection_id, int result));
145 MOCK_CONST_METHOD2(DeliverHostControlMessage,
146 void(const std::string control_type,
147 const std::string data));
148 MOCK_CONST_METHOD2(DeliverHostDataMessage,
149 void(int connection_id, const std::string data));
150
151 private:
152 DISALLOW_COPY_AND_ASSIGN(MockGnubbyAuthHandler);
153 };
154
155 class MockGnubbyConnection : public GnubbyConnection {
156 public:
157 MockGnubbyConnection(
158 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
159 GnubbyAuthHandler* auth_handler,
160 int connection_id,
161 net::StreamSocket* socket);
162 virtual ~MockGnubbyConnection();
163
164 MOCK_METHOD0(Read, void());
165 MOCK_METHOD1(Write, void(const std::string& data));
166
167 private:
168 DISALLOW_COPY_AND_ASSIGN(MockGnubbyConnection);
169 };
170
171 class MockGnubbyConnectionFactory : public GnubbyConnectionFactory {
172 public:
173 MockGnubbyConnectionFactory();
174 virtual ~MockGnubbyConnectionFactory();
175
176 MOCK_METHOD4(Create,
177 GnubbyConnection*(scoped_refptr<base::SingleThreadTaskRunner>
178 network_task_runner,
179 GnubbyAuthHandler* auth_handler,
180 int connection_id,
181 net::StreamSocket* socket));
182
183 private:
184 DISALLOW_COPY_AND_ASSIGN(MockGnubbyConnectionFactory);
185 };
186
129 } // namespace remoting 187 } // namespace remoting
130 188
131 #endif // REMOTING_HOST_HOST_MOCK_OBJECTS_H_ 189 #endif // REMOTING_HOST_HOST_MOCK_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698