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

Unified Diff: remoting/test/remote_host_info.cc

Issue 1237093004: Support for connecting to localhost on the chromoting test driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up ConnectionSetupInfo, comments, and merge changes. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/test/remote_host_info.cc
diff --git a/remoting/test/remote_host_info.cc b/remoting/test/remote_host_info.cc
index 62883902ce4bf144a884d1caabdbc465e774e6d0..d0a838f2db0dadbee08619fbfac71682290f4dfe 100644
--- a/remoting/test/remote_host_info.cc
+++ b/remoting/test/remote_host_info.cc
@@ -2,10 +2,20 @@
// 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/remote_host_info.h"
#include "base/logging.h"
+namespace {
+const char kAppRemotingCapabilities[] =
+ "rateLimitResizeRequests desktopShape sendInitialResolution googleDrive";
+const char kAppRemotingAuthenticationMethods[] = "third_party";
+const char kFakeHostPublicKey[] = "FAKE_HOST_PUBLIC_KEY";
+}
+
namespace remoting {
namespace test {
@@ -17,7 +27,7 @@ RemoteHostInfo::~RemoteHostInfo() {
}
bool RemoteHostInfo::IsReadyForConnection() const {
- return (remote_host_status == kRemoteHostStatusReady);
+ return remote_host_status == kRemoteHostStatusReady;
}
void RemoteHostInfo::SetRemoteHostStatusFromString(
@@ -32,5 +42,33 @@ void RemoteHostInfo::SetRemoteHostStatusFromString(
}
}
+ConnectionSetupInfo RemoteHostInfo::GenerateConnectionSetupInfo(
+ const std::string& access_token,
+ const std::string& user_name) const {
+ ConnectionSetupInfo connection_setup_info;
+ connection_setup_info.access_token = access_token;
+ connection_setup_info.authorization_code = authorization_code;
+ connection_setup_info.capabilities = kAppRemotingCapabilities;
+ connection_setup_info.host_id = host_id;
+ connection_setup_info.host_jid = host_jid;
+ connection_setup_info.public_key = kFakeHostPublicKey;
+ connection_setup_info.shared_secret = shared_secret;
+ connection_setup_info.user_name = user_name;
+
+ // Parse |kAppRemotingAuthenticationMethods| for authentication methods.
+ std::vector<std::string> parts;
+ base::SplitString(kAppRemotingAuthenticationMethods, ',', &parts);
+ std::vector<protocol::AuthenticationMethod> auth_methods;
+ for (std::string part : parts) {
+ protocol::AuthenticationMethod auth_method =
+ protocol::AuthenticationMethod::FromString(part);
+ if (auth_method.is_valid()) {
+ connection_setup_info.auth_methods.push_back(auth_method);
joedow 2015/07/16 23:26:34 same as the chromoting version, please remove the
tonychun 2015/07/17 16:25:49 Done.
+ }
+ }
+
+ return connection_setup_info;
+}
+
} // namespace test
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698