| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "remoting/base/url_request.h" | 21 #include "remoting/base/url_request.h" |
| 22 #include "remoting/client/audio_player.h" | 22 #include "remoting/client/audio_player.h" |
| 23 #include "remoting/client/chromoting_client.h" | 23 #include "remoting/client/chromoting_client.h" |
| 24 #include "remoting/client/client_context.h" | 24 #include "remoting/client/client_context.h" |
| 25 #include "remoting/client/client_user_interface.h" | 25 #include "remoting/client/client_user_interface.h" |
| 26 #include "remoting/codec/video_decoder_verbatim.h" | 26 #include "remoting/codec/video_decoder_verbatim.h" |
| 27 #include "remoting/codec/video_decoder_vpx.h" | 27 #include "remoting/codec/video_decoder_vpx.h" |
| 28 #include "remoting/host/chromoting_host.h" | 28 #include "remoting/host/chromoting_host.h" |
| 29 #include "remoting/host/chromoting_host_context.h" | 29 #include "remoting/host/chromoting_host_context.h" |
| 30 #include "remoting/host/fake_desktop_environment.h" | 30 #include "remoting/host/fake_desktop_environment.h" |
| 31 #include "remoting/protocol/auth_util.h" |
| 31 #include "remoting/protocol/frame_consumer.h" | 32 #include "remoting/protocol/frame_consumer.h" |
| 32 #include "remoting/protocol/jingle_session_manager.h" | 33 #include "remoting/protocol/jingle_session_manager.h" |
| 33 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 34 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 34 #include "remoting/protocol/negotiating_client_authenticator.h" | 35 #include "remoting/protocol/negotiating_client_authenticator.h" |
| 35 #include "remoting/protocol/session_config.h" | 36 #include "remoting/protocol/session_config.h" |
| 36 #include "remoting/protocol/transport_context.h" | 37 #include "remoting/protocol/transport_context.h" |
| 37 #include "remoting/protocol/video_frame_pump.h" | 38 #include "remoting/protocol/video_frame_pump.h" |
| 38 #include "remoting/protocol/video_renderer.h" | 39 #include "remoting/protocol/video_renderer.h" |
| 39 #include "remoting/signaling/fake_signal_strategy.h" | 40 #include "remoting/signaling/fake_signal_strategy.h" |
| 40 #include "remoting/test/cyclic_frame_generator.h" | 41 #include "remoting/test/cyclic_frame_generator.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 certs_dir.AppendASCII("unittest.selfsigned.der"), &host_cert)); | 343 certs_dir.AppendASCII("unittest.selfsigned.der"), &host_cert)); |
| 343 | 344 |
| 344 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); | 345 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); |
| 345 std::string key_string; | 346 std::string key_string; |
| 346 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); | 347 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); |
| 347 std::string key_base64; | 348 std::string key_base64; |
| 348 base::Base64Encode(key_string, &key_base64); | 349 base::Base64Encode(key_string, &key_base64); |
| 349 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(key_base64); | 350 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(key_base64); |
| 350 ASSERT_TRUE(key_pair.get()); | 351 ASSERT_TRUE(key_pair.get()); |
| 351 | 352 |
| 352 std::string host_pin_hash = protocol::ApplySharedSecretHashFunction( | 353 std::string host_pin_hash = |
| 353 protocol::HashFunction::HMAC_SHA256, kHostId, kHostPin); | 354 protocol::GetSharedSecretHash(kHostId, kHostPin); |
| 354 scoped_ptr<protocol::AuthenticatorFactory> auth_factory = | 355 scoped_ptr<protocol::AuthenticatorFactory> auth_factory = |
| 355 protocol::Me2MeHostAuthenticatorFactory::CreateWithPin( | 356 protocol::Me2MeHostAuthenticatorFactory::CreateWithPin( |
| 356 true, kHostOwner, host_cert, key_pair, "", host_pin_hash, nullptr); | 357 true, kHostOwner, host_cert, key_pair, "", host_pin_hash, nullptr); |
| 357 host_->SetAuthenticatorFactory(std::move(auth_factory)); | 358 host_->SetAuthenticatorFactory(std::move(auth_factory)); |
| 358 | 359 |
| 359 host_->AddStatusObserver(this); | 360 host_->AddStatusObserver(this); |
| 360 host_->Start(kHostOwner); | 361 host_->Start(kHostOwner); |
| 361 | 362 |
| 362 message_loop_.PostTask(FROM_HERE, | 363 message_loop_.PostTask(FROM_HERE, |
| 363 base::Bind(&ProtocolPerfTest::StartClientAfterHost, | 364 base::Bind(&ProtocolPerfTest::StartClientAfterHost, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 380 GetParam().bandwidth, GetParam().max_buffers); | 381 GetParam().bandwidth, GetParam().max_buffers); |
| 381 port_allocator_factory->socket_factory()->SetLatency( | 382 port_allocator_factory->socket_factory()->SetLatency( |
| 382 GetParam().latency_average, GetParam().latency_stddev); | 383 GetParam().latency_average, GetParam().latency_stddev); |
| 383 port_allocator_factory->socket_factory()->set_out_of_order_rate( | 384 port_allocator_factory->socket_factory()->set_out_of_order_rate( |
| 384 GetParam().out_of_order_rate); | 385 GetParam().out_of_order_rate); |
| 385 scoped_refptr<protocol::TransportContext> transport_context( | 386 scoped_refptr<protocol::TransportContext> transport_context( |
| 386 new protocol::TransportContext( | 387 new protocol::TransportContext( |
| 387 host_signaling_.get(), std::move(port_allocator_factory), nullptr, | 388 host_signaling_.get(), std::move(port_allocator_factory), nullptr, |
| 388 network_settings, protocol::TransportRole::CLIENT)); | 389 network_settings, protocol::TransportRole::CLIENT)); |
| 389 | 390 |
| 390 std::vector<protocol::AuthenticationMethod> auth_methods; | |
| 391 auth_methods.push_back( | |
| 392 protocol::AuthenticationMethod::SPAKE2_SHARED_SECRET_HMAC); | |
| 393 scoped_ptr<protocol::Authenticator> client_authenticator( | 391 scoped_ptr<protocol::Authenticator> client_authenticator( |
| 394 new protocol::NegotiatingClientAuthenticator( | 392 new protocol::NegotiatingClientAuthenticator( |
| 395 std::string(), // client_pairing_id | 393 std::string(), // client_pairing_id |
| 396 std::string(), // client_pairing_secret | 394 std::string(), // client_pairing_secret |
| 397 kHostId, | 395 kHostId, |
| 398 base::Bind(&ProtocolPerfTest::FetchPin, base::Unretained(this)), | 396 base::Bind(&ProtocolPerfTest::FetchPin, base::Unretained(this)), |
| 399 nullptr, auth_methods)); | 397 nullptr)); |
| 400 client_.reset( | 398 client_.reset( |
| 401 new ChromotingClient(client_context_.get(), this, this, nullptr)); | 399 new ChromotingClient(client_context_.get(), this, this, nullptr)); |
| 402 client_->set_protocol_config(protocol_config_->Clone()); | 400 client_->set_protocol_config(protocol_config_->Clone()); |
| 403 client_->Start(client_signaling_.get(), std::move(client_authenticator), | 401 client_->Start(client_signaling_.get(), std::move(client_authenticator), |
| 404 transport_context, kHostJid, std::string()); | 402 transport_context, kHostJid, std::string()); |
| 405 } | 403 } |
| 406 | 404 |
| 407 void FetchPin( | 405 void FetchPin( |
| 408 bool pairing_supported, | 406 bool pairing_supported, |
| 409 const protocol::SecretFetchedCallback& secret_fetched_callback) { | 407 const protocol::SecretFetchedCallback& secret_fetched_callback) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 629 |
| 632 TEST_P(ProtocolPerfTest, TotalLatencyIce) { | 630 TEST_P(ProtocolPerfTest, TotalLatencyIce) { |
| 633 MeasureTotalLatency(false); | 631 MeasureTotalLatency(false); |
| 634 } | 632 } |
| 635 | 633 |
| 636 TEST_P(ProtocolPerfTest, TotalLatencyWebrtc) { | 634 TEST_P(ProtocolPerfTest, TotalLatencyWebrtc) { |
| 637 MeasureTotalLatency(true); | 635 MeasureTotalLatency(true); |
| 638 } | 636 } |
| 639 | 637 |
| 640 } // namespace remoting | 638 } // namespace remoting |
| OLD | NEW |