| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/big_endian.h" | 7 #include "base/big_endian.h" |
| 8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
| 9 #include "media/cast/logging/logging_impl.h" | 9 #include "media/cast/logging/logging_impl.h" |
| 10 #include "media/cast/logging/simple_event_subscriber.h" | 10 #include "media/cast/logging/simple_event_subscriber.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 static const size_t kSize4 = 104; | 25 static const size_t kSize4 = 104; |
| 26 static const size_t kNackSize = 105; | 26 static const size_t kNackSize = 105; |
| 27 static const int64 kStartMillisecond = INT64_C(12345678900000); | 27 static const int64 kStartMillisecond = INT64_C(12345678900000); |
| 28 static const uint32 kVideoSsrc = 0x1234; | 28 static const uint32 kVideoSsrc = 0x1234; |
| 29 static const uint32 kAudioSsrc = 0x5678; | 29 static const uint32 kAudioSsrc = 0x5678; |
| 30 | 30 |
| 31 class TestPacketSender : public PacketSender { | 31 class TestPacketSender : public PacketSender { |
| 32 public: | 32 public: |
| 33 TestPacketSender() : bytes_sent_(0) {} | 33 TestPacketSender() : bytes_sent_(0) {} |
| 34 | 34 |
| 35 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) OVERRIDE { | 35 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) override { |
| 36 EXPECT_FALSE(expected_packet_size_.empty()); | 36 EXPECT_FALSE(expected_packet_size_.empty()); |
| 37 size_t expected_packet_size = expected_packet_size_.front(); | 37 size_t expected_packet_size = expected_packet_size_.front(); |
| 38 expected_packet_size_.pop_front(); | 38 expected_packet_size_.pop_front(); |
| 39 EXPECT_EQ(expected_packet_size, packet->data.size()); | 39 EXPECT_EQ(expected_packet_size, packet->data.size()); |
| 40 bytes_sent_ += packet->data.size(); | 40 bytes_sent_ += packet->data.size(); |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual int64 GetBytesSent() OVERRIDE { | 44 virtual int64 GetBytesSent() override { |
| 45 return bytes_sent_; | 45 return bytes_sent_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void AddExpectedSize(int expected_packet_size, int repeat_count) { | 48 void AddExpectedSize(int expected_packet_size, int repeat_count) { |
| 49 for (int i = 0; i < repeat_count; ++i) { | 49 for (int i = 0; i < repeat_count; ++i) { |
| 50 expected_packet_size_.push_back(expected_packet_size); | 50 expected_packet_size_.push_back(expected_packet_size); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 public: | 54 public: |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); | 461 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); |
| 462 EXPECT_EQ(static_cast<int64>(kSize1), mock_transport_.GetBytesSent()); | 462 EXPECT_EQ(static_cast<int64>(kSize1), mock_transport_.GetBytesSent()); |
| 463 | 463 |
| 464 dedup_info.resend_interval = base::TimeDelta::FromMilliseconds(5); | 464 dedup_info.resend_interval = base::TimeDelta::FromMilliseconds(5); |
| 465 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); | 465 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); |
| 466 EXPECT_EQ(static_cast<int64>(2 * kSize1), mock_transport_.GetBytesSent()); | 466 EXPECT_EQ(static_cast<int64>(2 * kSize1), mock_transport_.GetBytesSent()); |
| 467 } | 467 } |
| 468 | 468 |
| 469 } // namespace cast | 469 } // namespace cast |
| 470 } // namespace media | 470 } // namespace media |
| OLD | NEW |