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

Side by Side Diff: media/cast/receiver/frame_receiver_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/receiver/frame_receiver.h" 5 #include "media/cast/receiver/frame_receiver.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <deque> 9 #include <deque>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/test/simple_test_tick_clock.h" 16 #include "base/test/simple_test_tick_clock.h"
17 #include "media/base/fake_single_thread_task_runner.h"
17 #include "media/cast/cast_environment.h" 18 #include "media/cast/cast_environment.h"
18 #include "media/cast/logging/simple_event_subscriber.h" 19 #include "media/cast/logging/simple_event_subscriber.h"
19 #include "media/cast/net/cast_transport_sender_impl.h" 20 #include "media/cast/net/cast_transport_sender_impl.h"
20 #include "media/cast/net/mock_cast_transport_sender.h" 21 #include "media/cast/net/mock_cast_transport_sender.h"
21 #include "media/cast/net/rtcp/rtcp_utility.h" 22 #include "media/cast/net/rtcp/rtcp_utility.h"
22 #include "media/cast/net/rtcp/test_rtcp_packet_builder.h" 23 #include "media/cast/net/rtcp/test_rtcp_packet_builder.h"
23 #include "media/cast/test/fake_single_thread_task_runner.h"
24 #include "media/cast/test/utility/default_config.h" 24 #include "media/cast/test/utility/default_config.h"
25 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
26 26
27 using ::testing::_; 27 using ::testing::_;
28 28
29 namespace media { 29 namespace media {
30 namespace cast { 30 namespace cast {
31 31
32 namespace { 32 namespace {
33 33
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 DISALLOW_COPY_AND_ASSIGN(FakeFrameClient); 66 DISALLOW_COPY_AND_ASSIGN(FakeFrameClient);
67 }; 67 };
68 } // namespace 68 } // namespace
69 69
70 class FrameReceiverTest : public ::testing::Test { 70 class FrameReceiverTest : public ::testing::Test {
71 protected: 71 protected:
72 FrameReceiverTest() { 72 FrameReceiverTest() {
73 testing_clock_ = new base::SimpleTestTickClock(); 73 testing_clock_ = new base::SimpleTestTickClock();
74 testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks()); 74 testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
75 start_time_ = testing_clock_->NowTicks(); 75 start_time_ = testing_clock_->NowTicks();
76 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); 76 task_runner_ = new FakeSingleThreadTaskRunner(testing_clock_);
77 77
78 cast_environment_ = 78 cast_environment_ =
79 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_), 79 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_),
80 task_runner_, task_runner_, task_runner_); 80 task_runner_, task_runner_, task_runner_);
81 } 81 }
82 82
83 ~FrameReceiverTest() override {} 83 ~FrameReceiverTest() override {}
84 84
85 void SetUp() final { 85 void SetUp() final {
86 payload_.assign(kPacketSize, 0); 86 payload_.assign(kPacketSize, 0);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 rtp_timestamp.lower_32_bits()); 132 rtp_timestamp.lower_32_bits());
133 ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket())); 133 ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket()));
134 } 134 }
135 135
136 FrameReceiverConfig config_; 136 FrameReceiverConfig config_;
137 std::vector<uint8_t> payload_; 137 std::vector<uint8_t> payload_;
138 RtpCastHeader rtp_header_; 138 RtpCastHeader rtp_header_;
139 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. 139 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
140 base::TimeTicks start_time_; 140 base::TimeTicks start_time_;
141 MockCastTransportSender mock_transport_; 141 MockCastTransportSender mock_transport_;
142 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 142 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
143 scoped_refptr<CastEnvironment> cast_environment_; 143 scoped_refptr<CastEnvironment> cast_environment_;
144 FakeFrameClient frame_client_; 144 FakeFrameClient frame_client_;
145 145
146 // Important for the FrameReceiver to be declared last, since its dependencies 146 // Important for the FrameReceiver to be declared last, since its dependencies
147 // must remain alive until after its destruction. 147 // must remain alive until after its destruction.
148 scoped_ptr<FrameReceiver> receiver_; 148 scoped_ptr<FrameReceiver> receiver_;
149 149
150 private: 150 private:
151 DISALLOW_COPY_AND_ASSIGN(FrameReceiverTest); 151 DISALLOW_COPY_AND_ASSIGN(FrameReceiverTest);
152 }; 152 };
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 EXPECT_GE(kFirstFrameId + 3, frame_events[i].frame_id); 446 EXPECT_GE(kFirstFrameId + 3, frame_events[i].frame_id);
447 const int frame_offset = frame_events[i].frame_id - kFirstFrameId; 447 const int frame_offset = frame_events[i].frame_id - kFirstFrameId;
448 EXPECT_EQ(RtpTimeTicks() + (rtp_advance_per_frame * frame_offset), 448 EXPECT_EQ(RtpTimeTicks() + (rtp_advance_per_frame * frame_offset),
449 frame_events[i].rtp_timestamp); 449 frame_events[i].rtp_timestamp);
450 } 450 }
451 cast_environment_->logger()->Unsubscribe(&event_subscriber); 451 cast_environment_->logger()->Unsubscribe(&event_subscriber);
452 } 452 }
453 453
454 } // namespace cast 454 } // namespace cast
455 } // namespace media 455 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/rtp/rtp_packetizer_unittest.cc ('k') | media/cast/sender/audio_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698