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

Side by Side Diff: media/cast/receiver/frame_receiver_unittest.cc

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/receiver/frame_receiver.cc ('k') | media/cast/receiver/video_decoder.h » ('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 <deque> 5 #include <deque>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/test/simple_test_tick_clock.h" 11 #include "base/test/simple_test_tick_clock.h"
12 #include "media/cast/cast_defines.h" 12 #include "media/cast/cast_defines.h"
13 #include "media/cast/cast_environment.h" 13 #include "media/cast/cast_environment.h"
14 #include "media/cast/logging/simple_event_subscriber.h" 14 #include "media/cast/logging/simple_event_subscriber.h"
15 #include "media/cast/net/pacing/mock_paced_packet_sender.h"
16 #include "media/cast/net/rtcp/test_rtcp_packet_builder.h"
15 #include "media/cast/receiver/frame_receiver.h" 17 #include "media/cast/receiver/frame_receiver.h"
16 #include "media/cast/rtcp/test_rtcp_packet_builder.h"
17 #include "media/cast/test/fake_single_thread_task_runner.h" 18 #include "media/cast/test/fake_single_thread_task_runner.h"
18 #include "media/cast/test/utility/default_config.h" 19 #include "media/cast/test/utility/default_config.h"
19 #include "media/cast/transport/pacing/mock_paced_packet_sender.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 21
22 using ::testing::_; 22 using ::testing::_;
23 23
24 namespace media { 24 namespace media {
25 namespace cast { 25 namespace cast {
26 26
27 namespace { 27 namespace {
28 28
29 const int kPacketSize = 1500; 29 const int kPacketSize = 1500;
30 const uint32 kFirstFrameId = 1234; 30 const uint32 kFirstFrameId = 1234;
31 const int kPlayoutDelayMillis = 100; 31 const int kPlayoutDelayMillis = 100;
32 32
33 class FakeFrameClient { 33 class FakeFrameClient {
34 public: 34 public:
35 FakeFrameClient() : num_called_(0) {} 35 FakeFrameClient() : num_called_(0) {}
36 virtual ~FakeFrameClient() {} 36 virtual ~FakeFrameClient() {}
37 37
38 void AddExpectedResult(uint32 expected_frame_id, 38 void AddExpectedResult(uint32 expected_frame_id,
39 const base::TimeTicks& expected_playout_time) { 39 const base::TimeTicks& expected_playout_time) {
40 expected_results_.push_back( 40 expected_results_.push_back(
41 std::make_pair(expected_frame_id, expected_playout_time)); 41 std::make_pair(expected_frame_id, expected_playout_time));
42 } 42 }
43 43
44 void DeliverEncodedFrame(scoped_ptr<transport::EncodedFrame> frame) { 44 void DeliverEncodedFrame(scoped_ptr<EncodedFrame> frame) {
45 SCOPED_TRACE(::testing::Message() << "num_called_ is " << num_called_); 45 SCOPED_TRACE(::testing::Message() << "num_called_ is " << num_called_);
46 ASSERT_FALSE(!frame) 46 ASSERT_FALSE(!frame)
47 << "If at shutdown: There were unsatisfied requests enqueued."; 47 << "If at shutdown: There were unsatisfied requests enqueued.";
48 ASSERT_FALSE(expected_results_.empty()); 48 ASSERT_FALSE(expected_results_.empty());
49 EXPECT_EQ(expected_results_.front().first, frame->frame_id); 49 EXPECT_EQ(expected_results_.front().first, frame->frame_id);
50 EXPECT_EQ(expected_results_.front().second, frame->reference_time); 50 EXPECT_EQ(expected_results_.front().second, frame->reference_time);
51 expected_results_.pop_front(); 51 expected_results_.pop_front();
52 ++num_called_; 52 ++num_called_;
53 } 53 }
54 54
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ntp_seconds, ntp_fraction, 129 ntp_seconds, ntp_fraction,
130 static_cast<uint32>(rtp_timestamp)); 130 static_cast<uint32>(rtp_timestamp));
131 ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket().Pass())); 131 ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket().Pass()));
132 } 132 }
133 133
134 FrameReceiverConfig config_; 134 FrameReceiverConfig config_;
135 std::vector<uint8> payload_; 135 std::vector<uint8> payload_;
136 RtpCastHeader rtp_header_; 136 RtpCastHeader rtp_header_;
137 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. 137 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
138 base::TimeTicks start_time_; 138 base::TimeTicks start_time_;
139 transport::MockPacedPacketSender mock_transport_; 139 MockPacedPacketSender mock_transport_;
140 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 140 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
141 scoped_refptr<CastEnvironment> cast_environment_; 141 scoped_refptr<CastEnvironment> cast_environment_;
142 FakeFrameClient frame_client_; 142 FakeFrameClient frame_client_;
143 143
144 // Important for the FrameReceiver to be declared last, since its dependencies 144 // Important for the FrameReceiver to be declared last, since its dependencies
145 // must remain alive until after its destruction. 145 // must remain alive until after its destruction.
146 scoped_ptr<FrameReceiver> receiver_; 146 scoped_ptr<FrameReceiver> receiver_;
147 147
148 DISALLOW_COPY_AND_ASSIGN(FrameReceiverTest); 148 DISALLOW_COPY_AND_ASSIGN(FrameReceiverTest);
149 }; 149 };
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 EXPECT_GE(kFirstFrameId + 3, frame_events[i].frame_id); 410 EXPECT_GE(kFirstFrameId + 3, frame_events[i].frame_id);
411 const int frame_offset = frame_events[i].frame_id - kFirstFrameId; 411 const int frame_offset = frame_events[i].frame_id - kFirstFrameId;
412 EXPECT_EQ(frame_offset * rtp_advance_per_frame, 412 EXPECT_EQ(frame_offset * rtp_advance_per_frame,
413 frame_events[i].rtp_timestamp); 413 frame_events[i].rtp_timestamp);
414 } 414 }
415 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber); 415 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber);
416 } 416 }
417 417
418 } // namespace cast 418 } // namespace cast
419 } // namespace media 419 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/frame_receiver.cc ('k') | media/cast/receiver/video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698