Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: media/cast/sender/audio_sender_unittest.cc

Issue 655713003: Standardize usage of virtual/override/final in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cast/sender/audio_sender.h ('k') | media/cast/sender/congestion_control.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
11 #include "media/base/media.h" 11 #include "media/base/media.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/cast_environment.h" 13 #include "media/cast/cast_environment.h"
14 #include "media/cast/net/cast_transport_config.h" 14 #include "media/cast/net/cast_transport_config.h"
15 #include "media/cast/net/cast_transport_sender_impl.h" 15 #include "media/cast/net/cast_transport_sender_impl.h"
16 #include "media/cast/sender/audio_sender.h" 16 #include "media/cast/sender/audio_sender.h"
17 #include "media/cast/test/fake_single_thread_task_runner.h" 17 #include "media/cast/test/fake_single_thread_task_runner.h"
18 #include "media/cast/test/utility/audio_utility.h" 18 #include "media/cast/test/utility/audio_utility.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace media { 21 namespace media {
22 namespace cast { 22 namespace cast {
23 23
24 class TestPacketSender : public PacketSender { 24 class TestPacketSender : public PacketSender {
25 public: 25 public:
26 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {} 26 TestPacketSender() : number_of_rtp_packets_(0), number_of_rtcp_packets_(0) {}
27 27
28 virtual bool SendPacket(PacketRef packet, 28 bool SendPacket(PacketRef packet, const base::Closure& cb) override {
29 const base::Closure& cb) override {
30 if (Rtcp::IsRtcpPacket(&packet->data[0], packet->data.size())) { 29 if (Rtcp::IsRtcpPacket(&packet->data[0], packet->data.size())) {
31 ++number_of_rtcp_packets_; 30 ++number_of_rtcp_packets_;
32 } else { 31 } else {
33 // Check that at least one RTCP packet was sent before the first RTP 32 // Check that at least one RTCP packet was sent before the first RTP
34 // packet. This confirms that the receiver will have the necessary lip 33 // packet. This confirms that the receiver will have the necessary lip
35 // sync info before it has to calculate the playout time of the first 34 // sync info before it has to calculate the playout time of the first
36 // frame. 35 // frame.
37 if (number_of_rtp_packets_ == 0) 36 if (number_of_rtp_packets_ == 0)
38 EXPECT_LE(1, number_of_rtcp_packets_); 37 EXPECT_LE(1, number_of_rtcp_packets_);
39 ++number_of_rtp_packets_; 38 ++number_of_rtp_packets_;
40 } 39 }
41 return true; 40 return true;
42 } 41 }
43 42
44 virtual int64 GetBytesSent() override { 43 int64 GetBytesSent() override { return 0; }
45 return 0;
46 }
47 44
48 int number_of_rtp_packets() const { return number_of_rtp_packets_; } 45 int number_of_rtp_packets() const { return number_of_rtp_packets_; }
49 46
50 int number_of_rtcp_packets() const { return number_of_rtcp_packets_; } 47 int number_of_rtcp_packets() const { return number_of_rtcp_packets_; }
51 48
52 private: 49 private:
53 int number_of_rtp_packets_; 50 int number_of_rtp_packets_;
54 int number_of_rtcp_packets_; 51 int number_of_rtcp_packets_;
55 52
56 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); 53 DISALLOW_COPY_AND_ASSIGN(TestPacketSender);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 base::TimeDelta max_rtcp_timeout = 133 base::TimeDelta max_rtcp_timeout =
137 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2); 134 base::TimeDelta::FromMilliseconds(1 + kDefaultRtcpIntervalMs * 3 / 2);
138 testing_clock_->Advance(max_rtcp_timeout); 135 testing_clock_->Advance(max_rtcp_timeout);
139 task_runner_->RunTasks(); 136 task_runner_->RunTasks();
140 EXPECT_LE(1, transport_.number_of_rtp_packets()); 137 EXPECT_LE(1, transport_.number_of_rtp_packets());
141 EXPECT_LE(1, transport_.number_of_rtcp_packets()); 138 EXPECT_LE(1, transport_.number_of_rtcp_packets());
142 } 139 }
143 140
144 } // namespace cast 141 } // namespace cast
145 } // namespace media 142 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/audio_sender.h ('k') | media/cast/sender/congestion_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698