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

Side by Side 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: Refactored App Remoting and Chromoting code to share StartConnection method. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/test/remote_host_info.h" 5 #include "remoting/test/remote_host_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace {
10 const char kAppRemotingCapabilities[] =
11 "rateLimitResizeRequests desktopShape sendInitialResolution googleDrive";
12 const char kAppRemotingAuthenticationMethods[] = "third_party";
13 const char kFakeHostPublicKey[] = "FAKE_HOST_PUBLIC_KEY";
14 }
15
9 namespace remoting { 16 namespace remoting {
10 namespace test { 17 namespace test {
11 18
12 RemoteHostInfo::RemoteHostInfo() 19 RemoteHostInfo::RemoteHostInfo()
13 : remote_host_status(kRemoteHostStatusUnknown) { 20 : remote_host_status(kRemoteHostStatusUnknown) {
14 } 21 }
15 22
16 RemoteHostInfo::~RemoteHostInfo() { 23 RemoteHostInfo::~RemoteHostInfo() {
17 } 24 }
18 25
19 bool RemoteHostInfo::IsReadyForConnection() const { 26 bool RemoteHostInfo::IsReadyForConnection() const {
20 return (remote_host_status == kRemoteHostStatusReady); 27 return (remote_host_status == kRemoteHostStatusReady);
21 } 28 }
22 29
23 void RemoteHostInfo::SetRemoteHostStatusFromString( 30 void RemoteHostInfo::SetRemoteHostStatusFromString(
24 const std::string& status_string) { 31 const std::string& status_string) {
25 if (status_string == "done") { 32 if (status_string == "done") {
26 remote_host_status = kRemoteHostStatusReady; 33 remote_host_status = kRemoteHostStatusReady;
27 } else if (status_string == "pending") { 34 } else if (status_string == "pending") {
28 remote_host_status = kRemoteHostStatusPending; 35 remote_host_status = kRemoteHostStatusPending;
29 } else { 36 } else {
30 LOG(WARNING) << "Unknown status passed in: " << status_string; 37 LOG(WARNING) << "Unknown status passed in: " << status_string;
31 remote_host_status = kRemoteHostStatusUnknown; 38 remote_host_status = kRemoteHostStatusUnknown;
32 } 39 }
33 } 40 }
34 41
42 ConnectionInfo RemoteHostInfo::GenerateConnectionInfo(
43 const std::string& access_token,
44 const std::string& user_name) const {
45 ConnectionInfo connection_info;
46 connection_info.access_token = access_token;
47 connection_info.authorization_code = authorization_code;
48 connection_info.auth_methods_str = kAppRemotingAuthenticationMethods;
49 connection_info.capabilities = kAppRemotingCapabilities;
50 connection_info.host_id = host_id;
51 connection_info.host_jid = host_jid;
52 connection_info.public_key = kFakeHostPublicKey;
53 connection_info.shared_secret = shared_secret;
54 connection_info.user_name = user_name;
55
56 return connection_info;
57 }
58
35 } // namespace test 59 } // namespace test
36 } // namespace remoting 60 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698