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

Unified Diff: remoting/host/security_key/fake_security_key_ipc_server.h

Issue 2167473003: Revert of Renaming Gnubby and RemoteSecurityKey files/classes/members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/security_key/fake_security_key_ipc_server.h
diff --git a/remoting/host/security_key/fake_security_key_ipc_server.h b/remoting/host/security_key/fake_security_key_ipc_server.h
deleted file mode 100644
index 2a8bc5e9deef6f5fa8d960410b713d72fed9887d..0000000000000000000000000000000000000000
--- a/remoting/host/security_key/fake_security_key_ipc_server.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
-#define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
-
-#include "remoting/host/security_key/security_key_ipc_server.h"
-
-#include <cstdint>
-#include <map>
-#include <memory>
-#include <string>
-
-#include "base/callback_forward.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "ipc/ipc_listener.h"
-
-namespace IPC {
-class Channel;
-class Message;
-} // IPC
-
-namespace remoting {
-
-// Used to send/receive security key messages for testing. It provides a
-// WeakPtr reference to itself which allows tests to verify its lifetime is
-// managed properly without interfering with it.
-class FakeSecurityKeyIpcServer : public SecurityKeyIpcServer,
- public IPC::Listener {
- public:
- FakeSecurityKeyIpcServer(
- int connection_id,
- uint32_t peer_session_id,
- base::TimeDelta initial_connect_timeout,
- const SecurityKeyAuthHandler::SendMessageCallback& send_message_callback,
- const base::Closure& channel_closed_callback);
- ~FakeSecurityKeyIpcServer() override;
-
- // SecurityKeyIpcServer interface.
- bool CreateChannel(const std::string& channel_name,
- base::TimeDelta request_timeout) override;
- bool SendResponse(const std::string& message_data) override;
-
- // Simulates receipt of a security key request message.
- void SendRequest(const std::string& message_data);
-
- // Simulates the IPC channel being closed.
- void CloseChannel();
-
- // Returns a WeakPtr reference to this instance.
- base::WeakPtr<FakeSecurityKeyIpcServer> AsWeakPtr();
-
- // Returns the payload for the last message received.
- const std::string& last_message_received() const {
- return last_message_received_;
- }
-
- // The name of the IPC channel created by this instance.
- const std::string& channel_name() const { return channel_name_; }
-
- // Signaled when a security key response message is received.
- // NOTE: Ths callback will be used instead of the IPC channel for response
- // notifications if it is set.
- void set_send_response_callback(const base::Closure& send_response_callback) {
- send_response_callback_ = send_response_callback;
- }
-
- private:
- // IPC::Listener interface.
- bool OnMessageReceived(const IPC::Message& message) override;
- void OnChannelConnected(int32_t peer_pid) override;
- void OnChannelError() override;
-
- // The id assigned to this IPC connection.
- int connection_id_;
-
- // Name of the IPC channel this instance was told to connect to.
- std::string channel_name_;
-
- // The payload for the last message received.
- std::string last_message_received_;
-
- // Used to forward security key requests to the remote client.
- SecurityKeyAuthHandler::SendMessageCallback send_message_callback_;
-
- // Signaled when the IPC channel is closed.
- base::Closure channel_closed_callback_;
-
- // Signaled when a security key response message is received.
- base::Closure send_response_callback_;
-
- // Used for sending/receiving security key messages between processes.
- std::unique_ptr<IPC::Channel> ipc_channel_;
-
- // NOTE: Weak pointers must be invalidated before all other member variables.
- base::WeakPtrFactory<FakeSecurityKeyIpcServer> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcServer);
-};
-
-// Used to create FakeSecurityKeyIpcServer instances for testing.
-// Provides a method which will return a WeakPtr reference to each instance
-// this factory creates. This allows tests to inject/retrieve messages and
-// verify the backing instance is destroyed at the appropriate time.
-class FakeSecurityKeyIpcServerFactory : public SecurityKeyIpcServerFactory {
- public:
- FakeSecurityKeyIpcServerFactory();
- ~FakeSecurityKeyIpcServerFactory() override;
-
- // SecurityKeyIpcServerFactory implementation.
- std::unique_ptr<SecurityKeyIpcServer> Create(
- int connection_id,
- uint32_t peer_session_id,
- base::TimeDelta initial_connect_timeout,
- const SecurityKeyAuthHandler::SendMessageCallback& message_callback,
- const base::Closure& done_callback) override;
-
- // Provide a WeakPtr reference to the FakeSecurityKeyIpcServer object
- // created for the |connection_id| IPC channel.
- base::WeakPtr<FakeSecurityKeyIpcServer> GetIpcServerObject(int connection_id);
-
- private:
- // Tracks each FakeSecurityKeyIpcServer instance created by this
- // factory which allows them to be retrieved and queried for tests.
- std::map<int, base::WeakPtr<FakeSecurityKeyIpcServer>> ipc_server_map_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcServerFactory);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
« 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