OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 virtual void SetUp() OVERRIDE { | 88 virtual void SetUp() OVERRIDE { |
89 testing_clock_ = new base::SimpleTestTickClock(); | 89 testing_clock_ = new base::SimpleTestTickClock(); |
90 task_runner_ = new test::FakeTaskRunner(testing_clock_); | 90 task_runner_ = new test::FakeTaskRunner(testing_clock_); |
91 cast_environment_ = new CastEnvironment( | 91 cast_environment_ = new CastEnvironment( |
92 scoped_ptr<base::TickClock>(testing_clock_).Pass(), task_runner_, | 92 scoped_ptr<base::TickClock>(testing_clock_).Pass(), task_runner_, |
93 task_runner_, task_runner_, task_runner_, task_runner_, | 93 task_runner_, task_runner_, task_runner_, task_runner_, |
94 task_runner_, GetDefaultCastSenderLoggingConfig()); | 94 task_runner_, GetDefaultCastSenderLoggingConfig()); |
95 } | 95 } |
96 | 96 |
| 97 virtual void TearDown() OVERRIDE { |
| 98 video_encoder_.reset(); |
| 99 task_runner_->RunTasks(); |
| 100 } |
| 101 |
97 void Configure(uint8 max_unacked_frames) { | 102 void Configure(uint8 max_unacked_frames) { |
98 video_encoder_.reset(new VideoEncoderImpl(cast_environment_, video_config_, | 103 video_encoder_.reset(new VideoEncoderImpl(cast_environment_, video_config_, |
99 max_unacked_frames)); | 104 max_unacked_frames)); |
100 } | 105 } |
101 | 106 |
102 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. | 107 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. |
103 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_; | 108 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_; |
104 VideoSenderConfig video_config_; | 109 VideoSenderConfig video_config_; |
105 scoped_refptr<test::FakeTaskRunner> task_runner_; | 110 scoped_refptr<test::FakeTaskRunner> task_runner_; |
106 scoped_ptr<VideoEncoder> video_encoder_; | 111 scoped_ptr<VideoEncoder> video_encoder_; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 for (int i = 5; i < 17; ++i) { | 245 for (int i = 5; i < 17; ++i) { |
241 test_video_encoder_callback_->SetExpectedResult(false, i, 4, capture_time); | 246 test_video_encoder_callback_->SetExpectedResult(false, i, 4, capture_time); |
242 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(video_frame_, capture_time, | 247 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(video_frame_, capture_time, |
243 frame_encoded_callback)); | 248 frame_encoded_callback)); |
244 task_runner_->RunTasks(); | 249 task_runner_->RunTasks(); |
245 } | 250 } |
246 } | 251 } |
247 | 252 |
248 } // namespace cast | 253 } // namespace cast |
249 } // namespace media | 254 } // namespace media |
OLD | NEW |