Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / remoting / test / remote_host_info.cc
blob3e794927dc04a4440b93bd2503ff4368775ae5d1
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.
5 #include "remoting/protocol/authentication_method.h"
6 #include "remoting/test/remote_host_info.h"
8 #include "base/logging.h"
10 namespace {
11 const char kAppRemotingCapabilities[] =
12 "rateLimitResizeRequests desktopShape sendInitialResolution googleDrive";
13 const char kFakeHostPublicKey[] = "FAKE_HOST_PUBLIC_KEY";
16 namespace remoting {
17 namespace test {
19 RemoteHostInfo::RemoteHostInfo()
20 : remote_host_status(kRemoteHostStatusUnknown) {
23 RemoteHostInfo::~RemoteHostInfo() {
26 bool RemoteHostInfo::IsReadyForConnection() const {
27 return remote_host_status == kRemoteHostStatusReady;
30 void RemoteHostInfo::SetRemoteHostStatusFromString(
31 const std::string& status_string) {
32 if (status_string == "done") {
33 remote_host_status = kRemoteHostStatusReady;
34 } else if (status_string == "pending") {
35 remote_host_status = kRemoteHostStatusPending;
36 } else {
37 LOG(WARNING) << "Unknown status passed in: " << status_string;
38 remote_host_status = kRemoteHostStatusUnknown;
42 ConnectionSetupInfo RemoteHostInfo::GenerateConnectionSetupInfo(
43 const std::string& access_token,
44 const std::string& user_name) const {
45 ConnectionSetupInfo connection_setup_info;
46 connection_setup_info.access_token = access_token;
47 connection_setup_info.authorization_code = authorization_code;
48 connection_setup_info.capabilities = kAppRemotingCapabilities;
49 connection_setup_info.host_id = host_id;
50 connection_setup_info.host_jid = host_jid;
51 connection_setup_info.public_key = kFakeHostPublicKey;
52 connection_setup_info.shared_secret = shared_secret;
53 connection_setup_info.user_name = user_name;
55 connection_setup_info.auth_methods.push_back(
56 protocol::AuthenticationMethod::ThirdParty());
58 return connection_setup_info;
61 } // namespace test
62 } // namespace remoting