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

Side by Side Diff: components/proximity_auth/fake_connection.h

Issue 1351473003: Refactor fake Connection subclasses in proximity_auth/ tests to a single file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client_rename
Patch Set: rebase Created 5 years, 2 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 2015 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 COMPONENTS_PROXIMITY_AUTH_FAKE_CONNECTION_H
6 #define COMPONENTS_PROXIMITY_AUTH_FAKE_CONNECTION_H
7
8 #include "components/proximity_auth/connection.h"
9
10 namespace proximity_auth {
11
12 // A fake implementation of Connection to use in tests.
13 class FakeConnection : public Connection {
14 public:
15 FakeConnection(const RemoteDevice& remote_device);
16 ~FakeConnection() override;
17
18 // Connection:
19 void Connect() override;
20 void Disconnect() override;
21
22 // Completes the current send operation with success |success|.
23 void FinishSendingMessageWithSuccess(bool success);
24
25 // Simulates receiving a wire message with the given |payload|, bypassing the
26 // container WireMessage format.
27 void ReceiveMessageWithPayload(const std::string& payload);
28
29 // Returns the current message in progress of being sent.
30 WireMessage* current_message() { return current_message_.get(); }
31
32 using Connection::SetStatus;
33
34 private:
35 // Connection:
36 void SendMessageImpl(scoped_ptr<WireMessage> message) override;
37 scoped_ptr<WireMessage> DeserializeWireMessage(
38 bool* is_incomplete_message) override;
39
40 // The message currently being sent. Only set between a call to
41 // SendMessageImpl() and FinishSendingMessageWithSuccess().
42 scoped_ptr<WireMessage> current_message_;
43
44 // The payload that should be returned when DeserializeWireMessage() is
45 // called.
46 std::string pending_payload_;
47
48 DISALLOW_COPY_AND_ASSIGN(FakeConnection);
49 };
50
51 } // namespace proximity_auth
52
53 #endif // COMPONENTS_PROXIMITY_AUTH_FAKE_CONNECTION_H
OLDNEW
« no previous file with comments | « components/proximity_auth/bluetooth_throttler_impl_unittest.cc ('k') | components/proximity_auth/fake_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698