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

Side by Side Diff: media/cast/net/cast_transport_sender_impl_unittest.cc

Issue 1829163002: Lazily prune the multibuffer block cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no export Created 4 years, 8 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
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 "media/cast/net/cast_transport_sender_impl.h" 5 #include "media/cast/net/cast_transport_sender_impl.h"
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/test/simple_test_tick_clock.h" 15 #include "base/test/simple_test_tick_clock.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "media/base/fake_single_thread_task_runner.h"
17 #include "media/cast/net/cast_transport_config.h" 18 #include "media/cast/net/cast_transport_config.h"
18 #include "media/cast/net/rtcp/rtcp_defines.h" 19 #include "media/cast/net/rtcp/rtcp_defines.h"
19 #include "media/cast/test/fake_single_thread_task_runner.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace media { 22 namespace media {
23 namespace cast { 23 namespace cast {
24 24
25 namespace { 25 namespace {
26 26
27 const int64_t kStartMillisecond = INT64_C(12345678900000); 27 const int64_t kStartMillisecond = INT64_C(12345678900000);
28 const uint32_t kVideoSsrc = 1; 28 const uint32_t kVideoSsrc = 1;
29 const uint32_t kAudioSsrc = 2; 29 const uint32_t kAudioSsrc = 2;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 }; 74 };
75 75
76 class CastTransportSenderImplTest : public ::testing::Test { 76 class CastTransportSenderImplTest : public ::testing::Test {
77 public: 77 public:
78 void ReceivedLoggingEvents() { num_times_logging_callback_called_++; } 78 void ReceivedLoggingEvents() { num_times_logging_callback_called_++; }
79 79
80 protected: 80 protected:
81 CastTransportSenderImplTest() : num_times_logging_callback_called_(0) { 81 CastTransportSenderImplTest() : num_times_logging_callback_called_(0) {
82 testing_clock_.Advance( 82 testing_clock_.Advance(
83 base::TimeDelta::FromMilliseconds(kStartMillisecond)); 83 base::TimeDelta::FromMilliseconds(kStartMillisecond));
84 task_runner_ = new test::FakeSingleThreadTaskRunner(&testing_clock_); 84 task_runner_ = new FakeSingleThreadTaskRunner(&testing_clock_);
85 } 85 }
86 86
87 ~CastTransportSenderImplTest() override {} 87 ~CastTransportSenderImplTest() override {}
88 88
89 void InitWithoutLogging(); 89 void InitWithoutLogging();
90 void InitWithOptions(); 90 void InitWithOptions();
91 void InitWithLogging(); 91 void InitWithLogging();
92 92
93 void InitializeVideo() { 93 void InitializeVideo() {
94 CastTransportRtpConfig rtp_config; 94 CastTransportRtpConfig rtp_config;
95 rtp_config.ssrc = kVideoSsrc; 95 rtp_config.ssrc = kVideoSsrc;
96 rtp_config.feedback_ssrc = 2; 96 rtp_config.feedback_ssrc = 2;
97 rtp_config.rtp_payload_type = 3; 97 rtp_config.rtp_payload_type = 3;
98 transport_sender_->InitializeVideo(rtp_config, RtcpCastMessageCallback(), 98 transport_sender_->InitializeVideo(rtp_config, RtcpCastMessageCallback(),
99 RtcpRttCallback(), RtcpPliCallback()); 99 RtcpRttCallback(), RtcpPliCallback());
100 } 100 }
101 101
102 void InitializeAudio() { 102 void InitializeAudio() {
103 CastTransportRtpConfig rtp_config; 103 CastTransportRtpConfig rtp_config;
104 rtp_config.ssrc = kAudioSsrc; 104 rtp_config.ssrc = kAudioSsrc;
105 rtp_config.feedback_ssrc = 3; 105 rtp_config.feedback_ssrc = 3;
106 rtp_config.rtp_payload_type = 4; 106 rtp_config.rtp_payload_type = 4;
107 transport_sender_->InitializeAudio(rtp_config, RtcpCastMessageCallback(), 107 transport_sender_->InitializeAudio(rtp_config, RtcpCastMessageCallback(),
108 RtcpRttCallback(), RtcpPliCallback()); 108 RtcpRttCallback(), RtcpPliCallback());
109 } 109 }
110 110
111 base::SimpleTestTickClock testing_clock_; 111 base::SimpleTestTickClock testing_clock_;
112 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 112 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
113 scoped_ptr<CastTransportSenderImpl> transport_sender_; 113 scoped_ptr<CastTransportSenderImpl> transport_sender_;
114 FakePacketSender* transport_; // Owned by CastTransportSender. 114 FakePacketSender* transport_; // Owned by CastTransportSender.
115 int num_times_logging_callback_called_; 115 int num_times_logging_callback_called_;
116 }; 116 };
117 117
118 namespace { 118 namespace {
119 119
120 class TransportClient : public CastTransportSender::Client { 120 class TransportClient : public CastTransportSender::Client {
121 public: 121 public:
122 explicit TransportClient( 122 explicit TransportClient(
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 task_runner_->RunTasks(); 395 task_runner_->RunTasks();
396 EXPECT_EQ(7, transport_->packets_sent()); 396 EXPECT_EQ(7, transport_->packets_sent());
397 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. 397 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last.
398 398
399 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); 399 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2));
400 EXPECT_EQ(2, num_times_logging_callback_called_); 400 EXPECT_EQ(2, num_times_logging_callback_called_);
401 } 401 }
402 402
403 } // namespace cast 403 } // namespace cast
404 } // namespace media 404 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/stats_event_subscriber_unittest.cc ('k') | media/cast/net/pacing/paced_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698