Index: remoting/test/host_info.cc |
diff --git a/remoting/test/host_info.cc b/remoting/test/host_info.cc |
index 341829f662e5f40815c61b2b29e817de77cc8172..6b271f21aa3fd3567c3627170aec079b998692b9 100644 |
--- a/remoting/test/host_info.cc |
+++ b/remoting/test/host_info.cc |
@@ -2,10 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+ |
+#include "base/strings/string_split.h" |
+#include "remoting/protocol/authentication_method.h" |
#include "remoting/test/host_info.h" |
#include "base/logging.h" |
+namespace { |
+const char kChromotingAuthenticationMethods[] = |
+ "spake2_pair,spake2_plain,spake2_hmac,third_party"; |
+} |
+ |
namespace remoting { |
namespace test { |
@@ -70,5 +78,37 @@ bool HostInfo::ParseHostInfo(const base::DictionaryValue& host_info) { |
return true; |
} |
+bool HostInfo::IsReadyForConnection() const { |
+ return !host_jid.empty() && status == kHostStatusOnline; |
+} |
+ |
+ConnectionSetupInfo HostInfo::GenerateConnectionSetupInfo( |
+ const std::string& access_token, |
+ const std::string& user_name, |
+ const std::string& pin) const { |
+ ConnectionSetupInfo connection_setup_info; |
+ connection_setup_info.access_token = access_token; |
+ connection_setup_info.host_id = host_id; |
+ connection_setup_info.host_jid = host_jid; |
+ connection_setup_info.host_name = host_name; |
+ connection_setup_info.pin = pin; |
+ connection_setup_info.public_key = public_key; |
+ connection_setup_info.user_name = user_name; |
+ |
+ // Parse |kChromotingAuthenticationMethods| for authentication methods. |
+ std::vector<std::string> parts; |
+ base::SplitString(kChromotingAuthenticationMethods, ',', &parts); |
+ std::vector<protocol::AuthenticationMethod> auth_methods; |
+ for (std::string part : parts) { |
joedow
2015/07/16 23:26:34
I don't think you need to do any string parsing he
tonychun
2015/07/17 16:25:49
Done.
|
+ protocol::AuthenticationMethod auth_method = |
+ protocol::AuthenticationMethod::FromString(part); |
+ if (auth_method.is_valid()) { |
+ connection_setup_info.auth_methods.push_back(auth_method); |
+ } |
+ } |
+ |
+ return connection_setup_info; |
+} |
+ |
} // namespace test |
} // namespace remoting |