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

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

Issue 2170563002: 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_MESSAGE_WRITER_H_
6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_MESSAGE_WRITER_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "remoting/host/security_key/security_key_message.h"
14 #include "remoting/host/security_key/security_key_message_writer.h"
15
16 namespace remoting {
17
18 // Simulates the SecurityKeyMessageWriter and provides access to data
19 // members for testing.
20 class FakeSecurityKeyMessageWriter : public SecurityKeyMessageWriter {
21 public:
22 explicit FakeSecurityKeyMessageWriter(const base::Closure& write_callback);
23 ~FakeSecurityKeyMessageWriter() override;
24
25 // SecurityKeyMessageWriter interface.
26 bool WriteMessage(SecurityKeyMessageType message_type) override;
27 bool WriteMessageWithPayload(SecurityKeyMessageType message_type,
28 const std::string& message_payload) override;
29
30 base::WeakPtr<FakeSecurityKeyMessageWriter> AsWeakPtr();
31
32 SecurityKeyMessageType last_message_type() { return last_message_type_; }
33
34 const std::string& last_message_payload() { return last_message_payload_; }
35
36 void set_write_request_succeeded(bool should_succeed) {
37 write_request_succeeded_ = should_succeed;
38 }
39
40 private:
41 // Tracks the last message_type value written.
42 SecurityKeyMessageType last_message_type_ = SecurityKeyMessageType::INVALID;
43
44 // Tracks the last message_payload value written.
45 std::string last_message_payload_;
46
47 // This value is returned by the WriteMessage* functions above.
48 bool write_request_succeeded_ = true;
49
50 // Signaled whenever a write is requested.
51 base::Closure write_callback_;
52
53 base::WeakPtrFactory<FakeSecurityKeyMessageWriter> weak_factory_;
54
55 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyMessageWriter);
56 };
57
58 } // namespace remoting
59
60 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_MESSAGE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698