| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/test/simple_test_tick_clock.h" | 6 #include "base/test/simple_test_tick_clock.h" |
| 7 #include "media/cast/cast_defines.h" | 7 #include "media/cast/cast_defines.h" |
| 8 #include "media/cast/cast_environment.h" | 8 #include "media/cast/cast_environment.h" |
| 9 #include "media/cast/rtcp/rtcp_sender.h" | 9 #include "media/cast/rtcp/rtcp_sender.h" |
| 10 #include "media/cast/rtcp/rtcp_utility.h" | 10 #include "media/cast/rtcp/rtcp_utility.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 void SetExpectedRtcpPacket(const uint8* rtcp_buffer, size_t length) { | 48 void SetExpectedRtcpPacket(const uint8* rtcp_buffer, size_t length) { |
| 49 expected_packet_length_ = length; | 49 expected_packet_length_ = length; |
| 50 memcpy(expected_packet_, rtcp_buffer, length); | 50 memcpy(expected_packet_, rtcp_buffer, length); |
| 51 } | 51 } |
| 52 | 52 |
| 53 int packet_count() const { return packet_count_; } | 53 int packet_count() const { return packet_count_; } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 uint8 expected_packet_[kMaxIpPacketSize]; | 56 uint8 expected_packet_[kIpPacketSize]; |
| 57 size_t expected_packet_length_; | 57 size_t expected_packet_length_; |
| 58 int packet_count_; | 58 int packet_count_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class RtcpSenderTest : public ::testing::Test { | 61 class RtcpSenderTest : public ::testing::Test { |
| 62 protected: | 62 protected: |
| 63 RtcpSenderTest() | 63 RtcpSenderTest() |
| 64 : task_runner_(new test::FakeTaskRunner(&testing_clock_)), | 64 : task_runner_(new test::FakeTaskRunner(&testing_clock_)), |
| 65 cast_environment_(new CastEnvironment(&testing_clock_, task_runner_, | 65 cast_environment_(new CastEnvironment(&testing_clock_, task_runner_, |
| 66 task_runner_, task_runner_, task_runner_, task_runner_, | 66 task_runner_, task_runner_, task_runner_, task_runner_, |
| 67 task_runner_, GetDefaultCastLoggingConfig())), | 67 GetDefaultCastLoggingConfig())), |
| 68 rtcp_sender_(new RtcpSender(cast_environment_, | 68 rtcp_sender_(new RtcpSender(cast_environment_, |
| 69 &test_transport_, | 69 &test_transport_, |
| 70 kSendingSsrc, | 70 kSendingSsrc, |
| 71 kCName)) { | 71 kCName)) { |
| 72 } | 72 } |
| 73 | 73 |
| 74 base::SimpleTestTickClock testing_clock_; | 74 base::SimpleTestTickClock testing_clock_; |
| 75 TestRtcpTransport test_transport_; | 75 TestRtcpTransport test_transport_; |
| 76 scoped_refptr<test::FakeTaskRunner> task_runner_; | 76 scoped_refptr<test::FakeTaskRunner> task_runner_; |
| 77 scoped_refptr<CastEnvironment> cast_environment_; | 77 scoped_refptr<CastEnvironment> cast_environment_; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 NULL, | 452 NULL, |
| 453 NULL, | 453 NULL, |
| 454 &receiver_log); | 454 &receiver_log); |
| 455 | 455 |
| 456 EXPECT_EQ(1, test_transport_.packet_count()); | 456 EXPECT_EQ(1, test_transport_.packet_count()); |
| 457 EXPECT_EQ(81u, receiver_log.size()); | 457 EXPECT_EQ(81u, receiver_log.size()); |
| 458 } | 458 } |
| 459 | 459 |
| 460 } // namespace cast | 460 } // namespace cast |
| 461 } // namespace media | 461 } // namespace media |
| OLD | NEW |