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

Unified Diff: remoting/protocol/protocol_mock_objects.cc

Issue 16893002: Make the mapping from client id -> secret asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. Created 7 years, 6 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
« no previous file with comments | « remoting/protocol/protocol_mock_objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/protocol_mock_objects.cc
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc
index 072cf3c34deb23e5f1045ae78fa8f5ebed8105f2..eb4022abfb40312279ab38f28fc9cd094867e706 100644
--- a/remoting/protocol/protocol_mock_objects.cc
+++ b/remoting/protocol/protocol_mock_objects.cc
@@ -4,10 +4,6 @@
#include "remoting/protocol/protocol_mock_objects.h"
-#include "base/message_loop/message_loop_proxy.h"
-#include "net/base/ip_endpoint.h"
-#include "remoting/protocol/transport.h"
-
namespace remoting {
namespace protocol {
@@ -52,5 +48,34 @@ MockSessionManager::MockSessionManager() {}
MockSessionManager::~MockSessionManager() {}
+MockPairingRegistryDelegate::MockPairingRegistryDelegate() {
+}
+
+MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
+}
+
+void MockPairingRegistryDelegate::AddPairing(
+ const PairingRegistry::Pairing& new_paired_client) {
+ paired_clients_[new_paired_client.client_id] = new_paired_client;
+}
+
+void MockPairingRegistryDelegate::GetPairing(
+ const std::string& client_id,
+ const PairingRegistry::GetPairingCallback& callback) {
+ PairingRegistry::Pairing result;
+ PairingRegistry::PairedClients::const_iterator i =
+ paired_clients_.find(client_id);
+ if (i != paired_clients_.end()) {
+ result = i->second;
+ }
+ saved_callback_ = base::Bind(base::Bind(callback), result);
+}
+
+void MockPairingRegistryDelegate::RunCallback() {
+ DCHECK(!saved_callback_.is_null());
+ saved_callback_.Run();
+ saved_callback_.Reset();
+}
+
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/protocol_mock_objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698