| 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 <numeric> |    5 #include <numeric> | 
|    6 #include <utility> |    6 #include <utility> | 
|    7  |    7  | 
|    8 #include "base/base64.h" |    8 #include "base/base64.h" | 
|    9 #include "base/files/file_util.h" |    9 #include "base/files/file_util.h" | 
|   10 #include "base/macros.h" |   10 #include "base/macros.h" | 
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  235     EXPECT_GE(frame_stats_.size(), num_expected_frame_stats_); |  235     EXPECT_GE(frame_stats_.size(), num_expected_frame_stats_); | 
|  236   } |  236   } | 
|  237  |  237  | 
|  238   // Creates test host and client and starts connection between them. Caller |  238   // Creates test host and client and starts connection between them. Caller | 
|  239   // should call WaitConnected() to wait until connection is established. The |  239   // should call WaitConnected() to wait until connection is established. The | 
|  240   // host is started on |host_thread_| while the client works on the main |  240   // host is started on |host_thread_| while the client works on the main | 
|  241   // thread. |  241   // thread. | 
|  242   void StartHostAndClient(bool use_webrtc) { |  242   void StartHostAndClient(bool use_webrtc) { | 
|  243     fake_network_dispatcher_ =  new FakeNetworkDispatcher(); |  243     fake_network_dispatcher_ =  new FakeNetworkDispatcher(); | 
|  244  |  244  | 
|  245     client_signaling_.reset(new FakeSignalStrategy(kClientJid)); |  245     client_signaling_.reset( | 
 |  246         new FakeSignalStrategy(SignalingAddress(kClientJid))); | 
|  246  |  247  | 
|  247     jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |  248     jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 
|  248  |  249  | 
|  249     protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); |  250     protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); | 
|  250     protocol_config_->DisableAudioChannel(); |  251     protocol_config_->DisableAudioChannel(); | 
|  251     protocol_config_->set_webrtc_supported(use_webrtc); |  252     protocol_config_->set_webrtc_supported(use_webrtc); | 
|  252     protocol_config_->set_ice_supported(!use_webrtc); |  253     protocol_config_->set_ice_supported(!use_webrtc); | 
|  253  |  254  | 
|  254     host_thread_.task_runner()->PostTask( |  255     host_thread_.task_runner()->PostTask( | 
|  255         FROM_HERE, |  256         FROM_HERE, | 
|  256         base::Bind(&ProtocolPerfTest::StartHost, base::Unretained(this))); |  257         base::Bind(&ProtocolPerfTest::StartHost, base::Unretained(this))); | 
|  257   } |  258   } | 
|  258  |  259  | 
|  259   void StartHost() { |  260   void StartHost() { | 
|  260     DCHECK(host_thread_.task_runner()->BelongsToCurrentThread()); |  261     DCHECK(host_thread_.task_runner()->BelongsToCurrentThread()); | 
|  261  |  262  | 
|  262     jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |  263     jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 
|  263  |  264  | 
|  264     host_signaling_.reset(new FakeSignalStrategy(kHostJid)); |  265     host_signaling_.reset(new FakeSignalStrategy(SignalingAddress(kHostJid))); | 
|  265     host_signaling_->set_send_delay(GetParam().signaling_latency); |  266     host_signaling_->set_send_delay(GetParam().signaling_latency); | 
|  266     host_signaling_->ConnectTo(client_signaling_.get()); |  267     host_signaling_->ConnectTo(client_signaling_.get()); | 
|  267  |  268  | 
|  268     protocol::NetworkSettings network_settings( |  269     protocol::NetworkSettings network_settings( | 
|  269         protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING); |  270         protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING); | 
|  270  |  271  | 
|  271     std::unique_ptr<FakePortAllocatorFactory> port_allocator_factory( |  272     std::unique_ptr<FakePortAllocatorFactory> port_allocator_factory( | 
|  272         new FakePortAllocatorFactory(fake_network_dispatcher_)); |  273         new FakePortAllocatorFactory(fake_network_dispatcher_)); | 
|  273     port_allocator_factory->socket_factory()->SetBandwidth( |  274     port_allocator_factory->socket_factory()->SetBandwidth( | 
|  274         GetParam().bandwidth_kbps * 1000 / 8, GetParam().max_buffers); |  275         GetParam().bandwidth_kbps * 1000 / 8, GetParam().max_buffers); | 
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  636  |  637  | 
|  637 TEST_P(ProtocolPerfTest, ScrollPerformanceIce) { |  638 TEST_P(ProtocolPerfTest, ScrollPerformanceIce) { | 
|  638   MeasureScrollPerformance(false); |  639   MeasureScrollPerformance(false); | 
|  639 } |  640 } | 
|  640  |  641  | 
|  641 TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) { |  642 TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) { | 
|  642   MeasureScrollPerformance(true); |  643   MeasureScrollPerformance(true); | 
|  643 } |  644 } | 
|  644  |  645  | 
|  645 }  // namespace remoting |  646 }  // namespace remoting | 
| OLD | NEW |