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

Unified Diff: components/cryptauth/fake_secure_channel.h

Issue 2697763002: [CrOS Tether]: Create BleConnectionManager, which manages secure connections between the current de… (Closed)
Patch Set: Add missing DEP. Created 3 years, 10 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: components/cryptauth/fake_secure_channel.h
diff --git a/components/cryptauth/fake_secure_channel.h b/components/cryptauth/fake_secure_channel.h
new file mode 100644
index 0000000000000000000000000000000000000000..e086801b9572ac01145e6e6fb15ce5f9d4ab128a
--- /dev/null
+++ b/components/cryptauth/fake_secure_channel.h
@@ -0,0 +1,51 @@
+// Copyright 2017 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 COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_
+#define COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_
+
+#include "base/macros.h"
+#include "components/cryptauth/secure_channel.h"
+
+namespace cryptauth {
+
+// A fake implementation of SecureChannel to use in tests.
+class FakeSecureChannel : public SecureChannel {
+ public:
+ FakeSecureChannel(std::unique_ptr<Connection> connection,
+ std::unique_ptr<Delegate> delegate);
+ ~FakeSecureChannel() override;
+
+ struct SentMessage {
+ SentMessage(const std::string& feature, const std::string& payload);
+
+ std::string feature;
+ std::string payload;
+ };
+
+ void ChangeStatus(const Status& new_status);
+ void ReceiveMessage(const std::string& feature, const std::string& payload);
+
+ std::vector<Observer*> observers() { return observers_; }
+
+ std::vector<SentMessage> sent_messages() { return sent_messages_; }
+
+ // SecureChannel:
+ void Initialize() override;
+ void SendMessage(const std::string& feature,
+ const std::string& payload) override;
+ void Disconnect() override;
+ void AddObserver(Observer* observer) override;
+ void RemoveObserver(Observer* observer) override;
+
+ private:
+ std::vector<Observer*> observers_;
+ std::vector<SentMessage> sent_messages_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeSecureChannel);
+};
+
+} // namespace cryptauth
+
+#endif // COMPONENTS_CRYPTAUTH_FAKE_SECURE_CHANNEL_H_
« no previous file with comments | « components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc ('k') | components/cryptauth/fake_secure_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698