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

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

Issue 2277553002: Adding a new authenticator which can be used to validate the remote user (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy_change
Patch Set: Addressing Feedback Created 4 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 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 <stdint.h> 8 #include <cstdint>
9
10 #include <map> 9 #include <map>
10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "net/base/ip_endpoint.h" 18 #include "net/base/ip_endpoint.h"
19 #include "remoting/proto/internal.pb.h" 19 #include "remoting/proto/internal.pb.h"
20 #include "remoting/proto/video.pb.h" 20 #include "remoting/proto/video.pb.h"
21 #include "remoting/protocol/authenticator.h" 21 #include "remoting/protocol/authenticator.h"
22 #include "remoting/protocol/channel_authenticator.h"
22 #include "remoting/protocol/client_stub.h" 23 #include "remoting/protocol/client_stub.h"
23 #include "remoting/protocol/clipboard_stub.h" 24 #include "remoting/protocol/clipboard_stub.h"
24 #include "remoting/protocol/connection_to_client.h" 25 #include "remoting/protocol/connection_to_client.h"
25 #include "remoting/protocol/host_stub.h" 26 #include "remoting/protocol/host_stub.h"
26 #include "remoting/protocol/input_stub.h" 27 #include "remoting/protocol/input_stub.h"
27 #include "remoting/protocol/pairing_registry.h" 28 #include "remoting/protocol/pairing_registry.h"
28 #include "remoting/protocol/session.h" 29 #include "remoting/protocol/session.h"
29 #include "remoting/protocol/session_manager.h" 30 #include "remoting/protocol/session_manager.h"
30 #include "remoting/protocol/transport.h" 31 #include "remoting/protocol/transport.h"
31 #include "remoting/protocol/video_stub.h" 32 #include "remoting/protocol/video_stub.h"
32 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
34 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
33 35
34 namespace remoting { 36 namespace remoting {
35 namespace protocol { 37 namespace protocol {
36 38
39 class MockAuthenticator : public Authenticator {
40 public:
41 MockAuthenticator();
42 ~MockAuthenticator() override;
43
44 MOCK_CONST_METHOD0(state, Authenticator::State());
45 MOCK_CONST_METHOD0(started, bool());
46 MOCK_CONST_METHOD0(rejection_reason, Authenticator::RejectionReason());
47 MOCK_CONST_METHOD0(GetAuthKey, const std::string&());
48 MOCK_CONST_METHOD0(CreateChannelAuthenticatorPtr, ChannelAuthenticator*());
49 MOCK_METHOD2(ProcessMessage,
50 void(const buzz::XmlElement* message,
51 const base::Closure& resume_callback));
52 MOCK_METHOD0(GetNextMessagePtr, buzz::XmlElement*());
53
54 std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
55 const override {
56 return base::WrapUnique(CreateChannelAuthenticatorPtr());
57 }
58
59 std::unique_ptr<buzz::XmlElement> GetNextMessage() override {
60 return base::WrapUnique(GetNextMessagePtr());
61 }
62
63 private:
64 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator);
65 };
66
37 class MockConnectionToClientEventHandler 67 class MockConnectionToClientEventHandler
38 : public ConnectionToClient::EventHandler { 68 : public ConnectionToClient::EventHandler {
39 public: 69 public:
40 MockConnectionToClientEventHandler(); 70 MockConnectionToClientEventHandler();
41 ~MockConnectionToClientEventHandler() override; 71 ~MockConnectionToClientEventHandler() override;
42 72
43 MOCK_METHOD1(OnConnectionAuthenticating, 73 MOCK_METHOD1(OnConnectionAuthenticating,
44 void(ConnectionToClient* connection)); 74 void(ConnectionToClient* connection));
45 MOCK_METHOD1(OnConnectionAuthenticated, void(ConnectionToClient* connection)); 75 MOCK_METHOD1(OnConnectionAuthenticated, void(ConnectionToClient* connection));
46 MOCK_METHOD1(CreateVideoStreams, void(ConnectionToClient* connection)); 76 MOCK_METHOD1(CreateVideoStreams, void(ConnectionToClient* connection));
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Runs tasks synchronously instead of posting them to |task_runner|. 268 // Runs tasks synchronously instead of posting them to |task_runner|.
239 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 269 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
240 const tracked_objects::Location& from_here, 270 const tracked_objects::Location& from_here,
241 const base::Closure& task) override; 271 const base::Closure& task) override;
242 }; 272 };
243 273
244 } // namespace protocol 274 } // namespace protocol
245 } // namespace remoting 275 } // namespace remoting
246 276
247 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ 277 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698