| OLD | NEW |
| 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 #include "remoting/protocol/pseudotcp_adapter.h" | 5 #include "remoting/protocol/pseudotcp_adapter.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "jingle/glue/thread_wrapper.h" | 12 #include "jingle/glue/thread_wrapper.h" |
| 13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
| 16 #include "remoting/protocol/p2p_socket.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 namespace remoting { | 20 namespace remoting { |
| 20 namespace protocol { | 21 namespace protocol { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const int kMessageSize = 1024; | 25 const int kMessageSize = 1024; |
| 25 const int kMessages = 100; | 26 const int kMessages = 100; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return false; | 59 return false; |
| 59 } | 60 } |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 double volume_; | 63 double volume_; |
| 63 double rate_; | 64 double rate_; |
| 64 double level_; | 65 double level_; |
| 65 base::TimeTicks last_update_; | 66 base::TimeTicks last_update_; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 class FakeSocket : public net::Socket { | 69 class FakeSocket : public P2PDatagramSocket { |
| 69 public: | 70 public: |
| 70 FakeSocket() | 71 FakeSocket() |
| 71 : rate_limiter_(NULL), | 72 : rate_limiter_(NULL), |
| 72 latency_ms_(0) { | 73 latency_ms_(0) { |
| 73 } | 74 } |
| 74 ~FakeSocket() override {} | 75 ~FakeSocket() override {} |
| 75 | 76 |
| 76 void AppendInputPacket(const std::vector<char>& data) { | 77 void AppendInputPacket(const std::vector<char>& data) { |
| 77 if (rate_limiter_ && rate_limiter_->DropNextPacket()) | 78 if (rate_limiter_ && rate_limiter_->DropNextPacket()) |
| 78 return; // Lose the packet. | 79 return; // Lose the packet. |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 431 |
| 431 tester->Start(); | 432 tester->Start(); |
| 432 message_loop_.Run(); | 433 message_loop_.Run(); |
| 433 tester->CheckResults(); | 434 tester->CheckResults(); |
| 434 } | 435 } |
| 435 | 436 |
| 436 } // namespace | 437 } // namespace |
| 437 | 438 |
| 438 } // namespace protocol | 439 } // namespace protocol |
| 439 } // namespace remoting | 440 } // namespace remoting |
| OLD | NEW |