| Index: remoting/host/security_key/fake_remote_security_key_message_writer.h
|
| diff --git a/remoting/host/security_key/fake_remote_security_key_message_writer.h b/remoting/host/security_key/fake_remote_security_key_message_writer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4ae6759e1757397302c1aae61dde88eaa7e942a8
|
| --- /dev/null
|
| +++ b/remoting/host/security_key/fake_remote_security_key_message_writer.h
|
| @@ -0,0 +1,65 @@
|
| +// 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_REMOTE_SECURITY_KEY_MESSAGE_WRITER_H_
|
| +#define REMOTING_HOST_SECURITY_KEY_FAKE_REMOTE_SECURITY_KEY_MESSAGE_WRITER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "remoting/host/security_key/remote_security_key_message_writer.h"
|
| +#include "remoting/host/security_key/security_key_message.h"
|
| +
|
| +namespace remoting {
|
| +
|
| +// Simulates the RemoteSecurityKeyMessageWriter and provides access to data
|
| +// members for testing.
|
| +class FakeRemoteSecurityKeyMessageWriter
|
| + : public RemoteSecurityKeyMessageWriter {
|
| + public:
|
| + explicit FakeRemoteSecurityKeyMessageWriter(
|
| + const base::Closure& write_callback);
|
| + ~FakeRemoteSecurityKeyMessageWriter() override;
|
| +
|
| + // RemoteSecurityKeyMessageWriter interface.
|
| + bool WriteMessage(RemoteSecurityKeyMessageType message_type) override;
|
| + bool WriteMessageWithPayload(RemoteSecurityKeyMessageType message_type,
|
| + const std::string& message_payload) override;
|
| +
|
| + base::WeakPtr<FakeRemoteSecurityKeyMessageWriter> AsWeakPtr();
|
| +
|
| + RemoteSecurityKeyMessageType last_message_type() {
|
| + return last_message_type_;
|
| + }
|
| +
|
| + const std::string& last_message_payload() { return last_message_payload_; }
|
| +
|
| + void set_write_request_succeeded(bool should_succeed) {
|
| + write_request_succeeded_ = should_succeed;
|
| + }
|
| +
|
| + private:
|
| + // Tracks the last message_type value written.
|
| + RemoteSecurityKeyMessageType last_message_type_ =
|
| + RemoteSecurityKeyMessageType::INVALID;
|
| +
|
| + // Tracks the last message_payload value written.
|
| + std::string last_message_payload_;
|
| +
|
| + // This value is returned by the WriteMessage* functions above.
|
| + bool write_request_succeeded_ = true;
|
| +
|
| + // Signaled whenever a write is requested.
|
| + base::Closure write_callback_;
|
| +
|
| + base::WeakPtrFactory<FakeRemoteSecurityKeyMessageWriter> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FakeRemoteSecurityKeyMessageWriter);
|
| +};
|
| +
|
| +} // namespace remoting
|
| +
|
| +#endif // REMOTING_HOST_SECURITY_KEY_FAKE_REMOTE_SECURITY_KEY_MESSAGE_WRITER_H_
|
|
|