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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "media/base/media.h" | 9 #include "media/base/media.h" |
10 #include "media/cast/audio_sender/audio_sender.h" | 10 #include "media/cast/audio_sender/audio_sender.h" |
11 #include "media/cast/cast_config.h" | 11 #include "media/cast/cast_config.h" |
12 #include "media/cast/cast_environment.h" | 12 #include "media/cast/cast_environment.h" |
13 #include "media/cast/net/pacing/mock_paced_packet_sender.h" | |
14 #include "media/cast/test/audio_utility.h" | 13 #include "media/cast/test/audio_utility.h" |
15 #include "media/cast/test/fake_task_runner.h" | 14 #include "media/cast/test/fake_task_runner.h" |
| 15 #include "media/cast/transport/pacing/mock_paced_packet_sender.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 namespace cast { | 19 namespace cast { |
20 | 20 |
21 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); | 21 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); |
22 | 22 |
23 using testing::_; | 23 using testing::_; |
24 using testing::AtLeast; | 24 using testing::AtLeast; |
25 using testing::Exactly; | 25 using testing::Exactly; |
(...skipping 21 matching lines...) Expand all Loading... |
47 audio_config_.bitrate = kDefaultAudioEncoderBitrate; | 47 audio_config_.bitrate = kDefaultAudioEncoderBitrate; |
48 audio_config_.rtp_payload_type = 127; | 48 audio_config_.rtp_payload_type = 127; |
49 | 49 |
50 audio_sender_.reset( | 50 audio_sender_.reset( |
51 new AudioSender(cast_environment_, audio_config_, &mock_transport_)); | 51 new AudioSender(cast_environment_, audio_config_, &mock_transport_)); |
52 } | 52 } |
53 | 53 |
54 virtual ~AudioSenderTest() {} | 54 virtual ~AudioSenderTest() {} |
55 | 55 |
56 base::SimpleTestTickClock testing_clock_; | 56 base::SimpleTestTickClock testing_clock_; |
57 MockPacedPacketSender mock_transport_; | 57 transport::MockPacedPacketSender mock_transport_; |
58 scoped_refptr<test::FakeTaskRunner> task_runner_; | 58 scoped_refptr<test::FakeTaskRunner> task_runner_; |
59 scoped_ptr<AudioSender> audio_sender_; | 59 scoped_ptr<AudioSender> audio_sender_; |
60 scoped_refptr<CastEnvironment> cast_environment_; | 60 scoped_refptr<CastEnvironment> cast_environment_; |
61 AudioSenderConfig audio_config_; | 61 AudioSenderConfig audio_config_; |
62 }; | 62 }; |
63 | 63 |
64 TEST_F(AudioSenderTest, Encode20ms) { | 64 TEST_F(AudioSenderTest, Encode20ms) { |
65 EXPECT_CALL(mock_transport_, SendPackets(_)).Times(AtLeast(1)); | 65 EXPECT_CALL(mock_transport_, SendPackets(_)).Times(AtLeast(1)); |
66 EXPECT_CALL(*this, InsertAudioCallback()).Times(Exactly(1)); | 66 EXPECT_CALL(*this, InsertAudioCallback()).Times(Exactly(1)); |
67 | 67 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Make sure that we send at least one RTCP packet. | 101 // Make sure that we send at least one RTCP packet. |
102 base::TimeDelta max_rtcp_timeout = | 102 base::TimeDelta max_rtcp_timeout = |
103 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2); | 103 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2); |
104 testing_clock_.Advance(max_rtcp_timeout); | 104 testing_clock_.Advance(max_rtcp_timeout); |
105 task_runner_->RunTasks(); | 105 task_runner_->RunTasks(); |
106 } | 106 } |
107 | 107 |
108 } // namespace cast | 108 } // namespace cast |
109 } // namespace media | 109 } // namespace media |
OLD | NEW |