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

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: Edited merge errors, comments, and optimized code. 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
joedow 2015/07/17 23:26:30 remove extra newline
tonychun 2015/07/20 14:29:17 Done.
6 #include "base/strings/string_split.h"
joedow 2015/07/17 23:26:30 remove string_split header
tonychun 2015/07/20 14:29:17 Done.
7 #include "remoting/protocol/authentication_method.h"
5 #include "remoting/test/remote_host_info.h" 8 #include "remoting/test/remote_host_info.h"
6 9
7 #include "base/logging.h" 10 #include "base/logging.h"
8 11
12 namespace {
13 const char kAppRemotingCapabilities[] =
14 "rateLimitResizeRequests desktopShape sendInitialResolution googleDrive";
15 const char kFakeHostPublicKey[] = "FAKE_HOST_PUBLIC_KEY";
16 }
17
9 namespace remoting { 18 namespace remoting {
10 namespace test { 19 namespace test {
11 20
12 RemoteHostInfo::RemoteHostInfo() 21 RemoteHostInfo::RemoteHostInfo()
13 : remote_host_status(kRemoteHostStatusUnknown) { 22 : remote_host_status(kRemoteHostStatusUnknown) {
14 } 23 }
15 24
16 RemoteHostInfo::~RemoteHostInfo() { 25 RemoteHostInfo::~RemoteHostInfo() {
17 } 26 }
18 27
19 bool RemoteHostInfo::IsReadyForConnection() const { 28 bool RemoteHostInfo::IsReadyForConnection() const {
20 return (remote_host_status == kRemoteHostStatusReady); 29 return remote_host_status == kRemoteHostStatusReady;
21 } 30 }
22 31
23 void RemoteHostInfo::SetRemoteHostStatusFromString( 32 void RemoteHostInfo::SetRemoteHostStatusFromString(
24 const std::string& status_string) { 33 const std::string& status_string) {
25 if (status_string == "done") { 34 if (status_string == "done") {
26 remote_host_status = kRemoteHostStatusReady; 35 remote_host_status = kRemoteHostStatusReady;
27 } else if (status_string == "pending") { 36 } else if (status_string == "pending") {
28 remote_host_status = kRemoteHostStatusPending; 37 remote_host_status = kRemoteHostStatusPending;
29 } else { 38 } else {
30 LOG(WARNING) << "Unknown status passed in: " << status_string; 39 LOG(WARNING) << "Unknown status passed in: " << status_string;
31 remote_host_status = kRemoteHostStatusUnknown; 40 remote_host_status = kRemoteHostStatusUnknown;
32 } 41 }
33 } 42 }
34 43
44 ConnectionSetupInfo RemoteHostInfo::GenerateConnectionSetupInfo(
45 const std::string& access_token,
46 const std::string& user_name) const {
47 ConnectionSetupInfo connection_setup_info;
48 connection_setup_info.access_token = access_token;
49 connection_setup_info.authorization_code = authorization_code;
50 connection_setup_info.capabilities = kAppRemotingCapabilities;
51 connection_setup_info.host_id = host_id;
52 connection_setup_info.host_jid = host_jid;
53 connection_setup_info.public_key = kFakeHostPublicKey;
54 connection_setup_info.shared_secret = shared_secret;
55 connection_setup_info.user_name = user_name;
56 connection_setup_info.auth_methods.push_back(
57 protocol::AuthenticationMethod::ThirdParty());
joedow 2015/07/17 23:26:30 Please add some newlines as in host_info.cc
tonychun 2015/07/20 14:29:17 Done.
58
59 return connection_setup_info;
60 }
61
35 } // namespace test 62 } // namespace test
36 } // namespace remoting 63 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698