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

Side by Side Diff: remoting/host/security_key/fake_security_key_ipc_server.h

Issue 2162083003: Renaming Gnubby and RemoteSecurityKey files/classes/members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a GYP build error Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ 5 #ifndef REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
7 7
8 #include "remoting/host/security_key/remote_security_key_ipc_server.h" 8 #include "remoting/host/security_key/security_key_ipc_server.h"
9 9
10 #include <cstdint> 10 #include <cstdint>
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 14
15 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "ipc/ipc_listener.h" 18 #include "ipc/ipc_listener.h"
19 19
20 namespace IPC { 20 namespace IPC {
21 class Channel; 21 class Channel;
22 class Message; 22 class Message;
23 } // IPC 23 } // IPC
24 24
25 namespace remoting { 25 namespace remoting {
26 26
27 // Used to send/receive security key messages for testing. It provides a 27 // Used to send/receive security key messages for testing. It provides a
28 // WeakPtr reference to itself which allows tests to verify its lifetime is 28 // WeakPtr reference to itself which allows tests to verify its lifetime is
29 // managed properly without interfering with it. 29 // managed properly without interfering with it.
30 class FakeRemoteSecurityKeyIpcServer : public RemoteSecurityKeyIpcServer, 30 class FakeSecurityKeyIpcServer : public SecurityKeyIpcServer,
31 public IPC::Listener { 31 public IPC::Listener {
32 public: 32 public:
33 FakeRemoteSecurityKeyIpcServer( 33 FakeSecurityKeyIpcServer(
34 int connection_id, 34 int connection_id,
35 uint32_t peer_session_id, 35 uint32_t peer_session_id,
36 base::TimeDelta initial_connect_timeout, 36 base::TimeDelta initial_connect_timeout,
37 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, 37 const SecurityKeyAuthHandler::SendMessageCallback& send_message_callback,
38 const base::Closure& channel_closed_callback); 38 const base::Closure& channel_closed_callback);
39 ~FakeRemoteSecurityKeyIpcServer() override; 39 ~FakeSecurityKeyIpcServer() override;
40 40
41 // RemoteSecurityKeyIpcServer interface. 41 // SecurityKeyIpcServer interface.
42 bool CreateChannel(const std::string& channel_name, 42 bool CreateChannel(const std::string& channel_name,
43 base::TimeDelta request_timeout) override; 43 base::TimeDelta request_timeout) override;
44 bool SendResponse(const std::string& message_data) override; 44 bool SendResponse(const std::string& message_data) override;
45 45
46 // Simulates receipt of a security key request message. 46 // Simulates receipt of a security key request message.
47 void SendRequest(const std::string& message_data); 47 void SendRequest(const std::string& message_data);
48 48
49 // Simulates the IPC channel being closed. 49 // Simulates the IPC channel being closed.
50 void CloseChannel(); 50 void CloseChannel();
51 51
52 // Returns a WeakPtr reference to this instance. 52 // Returns a WeakPtr reference to this instance.
53 base::WeakPtr<FakeRemoteSecurityKeyIpcServer> AsWeakPtr(); 53 base::WeakPtr<FakeSecurityKeyIpcServer> AsWeakPtr();
54 54
55 // Returns the payload for the last message received. 55 // Returns the payload for the last message received.
56 const std::string& last_message_received() const { 56 const std::string& last_message_received() const {
57 return last_message_received_; 57 return last_message_received_;
58 } 58 }
59 59
60 // The name of the IPC channel created by this instance. 60 // The name of the IPC channel created by this instance.
61 const std::string& channel_name() const { return channel_name_; } 61 const std::string& channel_name() const { return channel_name_; }
62 62
63 // Signaled when a security key response message is received. 63 // Signaled when a security key response message is received.
(...skipping 12 matching lines...) Expand all
76 // The id assigned to this IPC connection. 76 // The id assigned to this IPC connection.
77 int connection_id_; 77 int connection_id_;
78 78
79 // Name of the IPC channel this instance was told to connect to. 79 // Name of the IPC channel this instance was told to connect to.
80 std::string channel_name_; 80 std::string channel_name_;
81 81
82 // The payload for the last message received. 82 // The payload for the last message received.
83 std::string last_message_received_; 83 std::string last_message_received_;
84 84
85 // Used to forward security key requests to the remote client. 85 // Used to forward security key requests to the remote client.
86 GnubbyAuthHandler::SendMessageCallback send_message_callback_; 86 SecurityKeyAuthHandler::SendMessageCallback send_message_callback_;
87 87
88 // Signaled when the IPC channel is closed. 88 // Signaled when the IPC channel is closed.
89 base::Closure channel_closed_callback_; 89 base::Closure channel_closed_callback_;
90 90
91 // Signaled when a security key response message is received. 91 // Signaled when a security key response message is received.
92 base::Closure send_response_callback_; 92 base::Closure send_response_callback_;
93 93
94 // Used for sending/receiving security key messages between processes. 94 // Used for sending/receiving security key messages between processes.
95 std::unique_ptr<IPC::Channel> ipc_channel_; 95 std::unique_ptr<IPC::Channel> ipc_channel_;
96 96
97 // NOTE: Weak pointers must be invalidated before all other member variables. 97 // NOTE: Weak pointers must be invalidated before all other member variables.
98 base::WeakPtrFactory<FakeRemoteSecurityKeyIpcServer> weak_factory_; 98 base::WeakPtrFactory<FakeSecurityKeyIpcServer> weak_factory_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(FakeRemoteSecurityKeyIpcServer); 100 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcServer);
101 }; 101 };
102 102
103 // Used to create FakeRemoteSecurityKeyIpcServer instances for testing. 103 // Used to create FakeSecurityKeyIpcServer instances for testing.
104 // Provides a method which will return a WeakPtr reference to each instance 104 // Provides a method which will return a WeakPtr reference to each instance
105 // this factory creates. This allows tests to inject/retrieve messages and 105 // this factory creates. This allows tests to inject/retrieve messages and
106 // verify the backing instance is destroyed at the appropriate time. 106 // verify the backing instance is destroyed at the appropriate time.
107 class FakeRemoteSecurityKeyIpcServerFactory 107 class FakeSecurityKeyIpcServerFactory : public SecurityKeyIpcServerFactory {
108 : public RemoteSecurityKeyIpcServerFactory {
109 public: 108 public:
110 FakeRemoteSecurityKeyIpcServerFactory(); 109 FakeSecurityKeyIpcServerFactory();
111 ~FakeRemoteSecurityKeyIpcServerFactory() override; 110 ~FakeSecurityKeyIpcServerFactory() override;
112 111
113 // RemoteSecurityKeyIpcServerFactory implementation. 112 // SecurityKeyIpcServerFactory implementation.
114 std::unique_ptr<RemoteSecurityKeyIpcServer> Create( 113 std::unique_ptr<SecurityKeyIpcServer> Create(
115 int connection_id, 114 int connection_id,
116 uint32_t peer_session_id, 115 uint32_t peer_session_id,
117 base::TimeDelta initial_connect_timeout, 116 base::TimeDelta initial_connect_timeout,
118 const GnubbyAuthHandler::SendMessageCallback& message_callback, 117 const SecurityKeyAuthHandler::SendMessageCallback& message_callback,
119 const base::Closure& done_callback) override; 118 const base::Closure& done_callback) override;
120 119
121 // Provide a WeakPtr reference to the FakeRemoteSecurityKeyIpcServer object 120 // Provide a WeakPtr reference to the FakeSecurityKeyIpcServer object
122 // created for the |connection_id| IPC channel. 121 // created for the |connection_id| IPC channel.
123 base::WeakPtr<FakeRemoteSecurityKeyIpcServer> GetIpcServerObject( 122 base::WeakPtr<FakeSecurityKeyIpcServer> GetIpcServerObject(int connection_id);
124 int connection_id);
125 123
126 private: 124 private:
127 // Tracks each FakeRemoteSecurityKeyIpcServer instance created by this 125 // Tracks each FakeSecurityKeyIpcServer instance created by this
128 // factory which allows them to be retrieved and queried for tests. 126 // factory which allows them to be retrieved and queried for tests.
129 std::map<int, base::WeakPtr<FakeRemoteSecurityKeyIpcServer>> ipc_server_map_; 127 std::map<int, base::WeakPtr<FakeSecurityKeyIpcServer>> ipc_server_map_;
130 128
131 DISALLOW_COPY_AND_ASSIGN(FakeRemoteSecurityKeyIpcServerFactory); 129 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcServerFactory);
132 }; 130 };
133 131
134 } // namespace remoting 132 } // namespace remoting
135 133
136 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ 134 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
OLDNEW
« no previous file with comments | « remoting/host/security_key/fake_security_key_ipc_client.cc ('k') | remoting/host/security_key/fake_security_key_ipc_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698