Chromium Code Reviews| Index: remoting/test/test_chromoting_client.cc |
| diff --git a/remoting/test/test_chromoting_client.cc b/remoting/test/test_chromoting_client.cc |
| index dbf4ecacc857efeba1d5cfd61d137b6bf691a82e..4efcf0e3e43add598f7c3280ef7ab2846dad640b 100644 |
| --- a/remoting/test/test_chromoting_client.cc |
| +++ b/remoting/test/test_chromoting_client.cc |
| @@ -17,7 +17,6 @@ |
| #include "remoting/client/chromoting_client.h" |
| #include "remoting/client/client_context.h" |
| #include "remoting/client/token_fetcher_proxy.h" |
| -#include "remoting/protocol/authentication_method.h" |
| #include "remoting/protocol/chromium_port_allocator.h" |
| #include "remoting/protocol/host_stub.h" |
| #include "remoting/protocol/libjingle_transport_factory.h" |
| @@ -26,14 +25,9 @@ |
| #include "remoting/protocol/session_config.h" |
| #include "remoting/protocol/third_party_client_authenticator.h" |
| #include "remoting/signaling/xmpp_signal_strategy.h" |
| -#include "remoting/test/remote_host_info_fetcher.h" |
| #include "remoting/test/test_video_renderer.h" |
| namespace { |
| - |
| -const char kAppRemotingCapabilities[] = |
| - "rateLimitResizeRequests desktopShape sendInitialResolution googleDrive"; |
| - |
| const char kXmppHostName[] = "talk.google.com"; |
| const int kXmppPortNumber = 5222; |
| @@ -58,6 +52,13 @@ void FetchThirdPartyToken( |
| } |
| } |
| +void FetchSecret( |
| + const std::string& client_secret, |
| + bool pairing_expected, |
| + const remoting::protocol::SecretFetchedCallback& secret_fetched_callback) { |
| + secret_fetched_callback.Run(client_secret); |
| +} |
| + |
| const char* ConnectionStateToFriendlyString( |
| remoting::protocol::ConnectionToHost::State state) { |
| switch (state) { |
| @@ -147,13 +148,7 @@ TestChromotingClient::~TestChromotingClient() { |
| } |
| void TestChromotingClient::StartConnection( |
| - const std::string& user_name, |
| - const std::string& access_token, |
| - const RemoteHostInfo& remote_host_info) { |
| - DCHECK(!user_name.empty()); |
| - DCHECK(!access_token.empty()); |
| - DCHECK(remote_host_info.IsReadyForConnection()); |
| - |
| + const ConnectionSetupInfo& connection_setup_info) { |
| // Required to establish a connection to the host. |
| jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| @@ -183,8 +178,8 @@ void TestChromotingClient::StartConnection( |
| xmpp_server_config.host = kXmppHostName; |
| xmpp_server_config.port = kXmppPortNumber; |
| xmpp_server_config.use_tls = true; |
| - xmpp_server_config.username = user_name; |
| - xmpp_server_config.auth_token = access_token; |
| + xmpp_server_config.username = connection_setup_info.user_name; |
| + xmpp_server_config.auth_token = connection_setup_info.access_token; |
| // Set up the signal strategy. This must outlive the client object. |
| signal_strategy_.reset( |
| @@ -205,26 +200,27 @@ void TestChromotingClient::StartConnection( |
| scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> |
| token_fetcher(new TokenFetcherProxy( |
| - base::Bind(&FetchThirdPartyToken, remote_host_info.authorization_code, |
| - remote_host_info.shared_secret), |
| - "FAKE_HOST_PUBLIC_KEY")); |
| - |
| - std::vector<protocol::AuthenticationMethod> auth_methods; |
| - auth_methods.push_back(protocol::AuthenticationMethod::ThirdParty()); |
| + base::Bind(&FetchThirdPartyToken, |
| + connection_setup_info.authorization_code, |
| + connection_setup_info.shared_secret), |
| + connection_setup_info.public_key)); |
| - // FetchSecretCallback is used for PIN based auth which we aren't using so we |
| - // can pass a null callback here. |
| protocol::FetchSecretCallback fetch_secret_callback; |
| + if (!connection_setup_info.pin.empty()) { |
| + fetch_secret_callback = base::Bind(&FetchSecret, connection_setup_info.pin); |
| + } |
|
joedow
2015/07/17 23:26:30
add newline here please
tonychun
2015/07/20 14:29:17
Done.
|
| scoped_ptr<protocol::Authenticator> authenticator( |
| new protocol::NegotiatingClientAuthenticator( |
| - std::string(), // client_pairing_id |
| - std::string(), // shared_secret |
| - std::string(), // authentication_tag |
| - fetch_secret_callback, token_fetcher.Pass(), auth_methods)); |
| - |
| - chromoting_client_->Start(signal_strategy_.get(), authenticator.Pass(), |
| - transport_factory.Pass(), remote_host_info.host_jid, |
| - kAppRemotingCapabilities); |
| + connection_setup_info.pairing_id, |
| + connection_setup_info.shared_secret, |
| + connection_setup_info.host_id, |
| + fetch_secret_callback, |
| + token_fetcher.Pass(), |
| + connection_setup_info.auth_methods)); |
| + |
| + chromoting_client_->Start( |
| + signal_strategy_.get(), authenticator.Pass(), transport_factory.Pass(), |
| + connection_setup_info.host_jid, connection_setup_info.capabilities); |
| } |
| void TestChromotingClient::EndConnection() { |