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

Side by Side Diff: media/cast/video_sender/video_sender_unittest.cc

Issue 163553006: Cast: Refactoring Cast API's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates and rebase Created 6 years, 9 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
OLDNEW
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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/test/simple_test_tick_clock.h" 9 #include "base/test/simple_test_tick_clock.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); 57 DISALLOW_COPY_AND_ASSIGN(TestPacketSender);
58 }; 58 };
59 59
60 class PeerVideoSender : public VideoSender { 60 class PeerVideoSender : public VideoSender {
61 public: 61 public:
62 PeerVideoSender( 62 PeerVideoSender(
63 scoped_refptr<CastEnvironment> cast_environment, 63 scoped_refptr<CastEnvironment> cast_environment,
64 const VideoSenderConfig& video_config, 64 const VideoSenderConfig& video_config,
65 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, 65 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories,
66 const CastInitializationCallback& initialization_status, 66 const CastInitializationCallback& cast_initialization_cb,
67 transport::CastTransportSender* const transport_sender) 67 transport::CastTransportSender* const transport_sender)
68 : VideoSender(cast_environment, 68 : VideoSender(cast_environment,
69 video_config, 69 video_config,
70 gpu_factories, 70 gpu_factories,
71 initialization_status, 71 cast_initialization_cb,
72 transport_sender) {} 72 transport_sender) {}
73 using VideoSender::OnReceivedCastFeedback; 73 using VideoSender::OnReceivedCastFeedback;
74 }; 74 };
75 } // namespace 75 } // namespace
76 76
77 class VideoSenderTest : public ::testing::Test { 77 class VideoSenderTest : public ::testing::Test {
78 protected: 78 protected:
79 VideoSenderTest() { 79 VideoSenderTest() {
80 testing_clock_ = new base::SimpleTestTickClock(); 80 testing_clock_ = new base::SimpleTestTickClock();
81 testing_clock_->Advance( 81 testing_clock_->Advance(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 void RunTasks(int during_ms) { 163 void RunTasks(int during_ms) {
164 for (int i = 0; i < during_ms; ++i) { 164 for (int i = 0; i < during_ms; ++i) {
165 // Call process the timers every 1 ms. 165 // Call process the timers every 1 ms.
166 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); 166 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1));
167 task_runner_->RunTasks(); 167 task_runner_->RunTasks();
168 } 168 }
169 } 169 }
170 170
171 void InitializationResult(CastInitializationStatus result) { 171 void InitializationResult(CastInitializationStatus result) {
172 EXPECT_EQ(result, STATUS_INITIALIZED); 172 EXPECT_EQ(result, STATUS_VIDEO_INITIALIZED);
173 } 173 }
174 174
175 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. 175 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
176 TestPacketSender transport_; 176 TestPacketSender transport_;
177 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; 177 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_;
178 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 178 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
179 scoped_ptr<PeerVideoSender> video_sender_; 179 scoped_ptr<PeerVideoSender> video_sender_;
180 scoped_refptr<CastEnvironment> cast_environment_; 180 scoped_refptr<CastEnvironment> cast_environment_;
181 181
182 DISALLOW_COPY_AND_ASSIGN(VideoSenderTest); 182 DISALLOW_COPY_AND_ASSIGN(VideoSenderTest);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Empty the pipeline. 330 // Empty the pipeline.
331 RunTasks(100); 331 RunTasks(100);
332 // Should have sent at least 7 packets. 332 // Should have sent at least 7 packets.
333 EXPECT_GE( 333 EXPECT_GE(
334 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), 334 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(),
335 7); 335 7);
336 } 336 }
337 337
338 } // namespace cast 338 } // namespace cast
339 } // namespace media 339 } // namespace media
OLDNEW
« media/cast/test/sender.cc ('K') | « media/cast/video_sender/video_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698