| 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 latency_stddev(base::TimeDelta::FromMillisecondsD(latency_stddev_ms)), | 54 latency_stddev(base::TimeDelta::FromMillisecondsD(latency_stddev_ms)), |
| 55 out_of_order_rate(out_of_order_rate) {} | 55 out_of_order_rate(out_of_order_rate) {} |
| 56 | 56 |
| 57 int bandwidth; | 57 int bandwidth; |
| 58 int max_buffers; | 58 int max_buffers; |
| 59 base::TimeDelta latency_average; | 59 base::TimeDelta latency_average; |
| 60 base::TimeDelta latency_stddev; | 60 base::TimeDelta latency_stddev; |
| 61 double out_of_order_rate; | 61 double out_of_order_rate; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class FakeCursorShapeStub : public protocol::CursorShapeStub { |
| 65 public: |
| 66 FakeCursorShapeStub() {} |
| 67 virtual ~FakeCursorShapeStub() {} |
| 68 |
| 69 // protocol::CursorShapeStub interface. |
| 70 virtual void SetCursorShape( |
| 71 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE {}; |
| 72 }; |
| 73 |
| 64 class ProtocolPerfTest | 74 class ProtocolPerfTest |
| 65 : public testing::Test, | 75 : public testing::Test, |
| 66 public testing::WithParamInterface<NetworkPerformanceParams>, | 76 public testing::WithParamInterface<NetworkPerformanceParams>, |
| 67 public ClientUserInterface, | 77 public ClientUserInterface, |
| 68 public VideoRenderer, | 78 public VideoRenderer, |
| 69 public HostStatusObserver { | 79 public HostStatusObserver { |
| 70 public: | 80 public: |
| 71 ProtocolPerfTest() | 81 ProtocolPerfTest() |
| 72 : host_thread_("host"), | 82 : host_thread_("host"), |
| 73 capture_thread_("capture"), | 83 capture_thread_("capture"), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 101 } | 111 } |
| 102 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE {} | 112 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE {} |
| 103 virtual void SetPairingResponse( | 113 virtual void SetPairingResponse( |
| 104 const protocol::PairingResponse& pairing_response) OVERRIDE {} | 114 const protocol::PairingResponse& pairing_response) OVERRIDE {} |
| 105 virtual void DeliverHostMessage( | 115 virtual void DeliverHostMessage( |
| 106 const protocol::ExtensionMessage& message) OVERRIDE {} | 116 const protocol::ExtensionMessage& message) OVERRIDE {} |
| 107 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE { | 117 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE { |
| 108 return NULL; | 118 return NULL; |
| 109 } | 119 } |
| 110 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE { | 120 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE { |
| 111 return NULL; | 121 return &cursor_shape_stub_; |
| 112 } | 122 } |
| 113 | 123 |
| 114 // VideoRenderer interface. | 124 // VideoRenderer interface. |
| 115 virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE {} | 125 virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE {} |
| 116 virtual ChromotingStats* GetStats() OVERRIDE { return NULL; } | 126 virtual ChromotingStats* GetStats() OVERRIDE { return NULL; } |
| 117 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, | 127 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, |
| 118 const base::Closure& done) OVERRIDE { | 128 const base::Closure& done) OVERRIDE { |
| 119 if (video_packet->data().empty()) { | 129 if (video_packet->data().empty()) { |
| 120 // Ignore keep-alive packets | 130 // Ignore keep-alive packets |
| 121 done.Run(); | 131 done.Run(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 338 |
| 329 base::MessageLoopForIO message_loop_; | 339 base::MessageLoopForIO message_loop_; |
| 330 | 340 |
| 331 scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher_; | 341 scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher_; |
| 332 | 342 |
| 333 base::Thread host_thread_; | 343 base::Thread host_thread_; |
| 334 base::Thread capture_thread_; | 344 base::Thread capture_thread_; |
| 335 base::Thread encode_thread_; | 345 base::Thread encode_thread_; |
| 336 FakeDesktopEnvironmentFactory desktop_environment_factory_; | 346 FakeDesktopEnvironmentFactory desktop_environment_factory_; |
| 337 | 347 |
| 348 FakeCursorShapeStub cursor_shape_stub_; |
| 349 |
| 338 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; | 350 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; |
| 339 | 351 |
| 340 scoped_ptr<FakeSignalStrategy> host_signaling_; | 352 scoped_ptr<FakeSignalStrategy> host_signaling_; |
| 341 scoped_ptr<FakeSignalStrategy> client_signaling_; | 353 scoped_ptr<FakeSignalStrategy> client_signaling_; |
| 342 | 354 |
| 343 scoped_ptr<ChromotingHost> host_; | 355 scoped_ptr<ChromotingHost> host_; |
| 344 scoped_ptr<ClientContext> client_context_; | 356 scoped_ptr<ClientContext> client_context_; |
| 345 scoped_ptr<ChromotingClient> client_; | 357 scoped_ptr<ChromotingClient> client_; |
| 346 | 358 |
| 347 scoped_ptr<base::RunLoop> connecting_loop_; | 359 scoped_ptr<base::RunLoop> connecting_loop_; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 << "ms Encode: " << last_video_packet_->encode_time_ms() | 489 << "ms Encode: " << last_video_packet_->encode_time_ms() |
| 478 << "ms Capture: " << last_video_packet_->capture_time_ms() | 490 << "ms Capture: " << last_video_packet_->capture_time_ms() |
| 479 << "ms"; | 491 << "ms"; |
| 480 sum += latency; | 492 sum += latency; |
| 481 } | 493 } |
| 482 | 494 |
| 483 LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); | 495 LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); |
| 484 } | 496 } |
| 485 | 497 |
| 486 } // namespace remoting | 498 } // namespace remoting |
| OLD | NEW |