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

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

Issue 25544003: Fix code style and gyp files in cast to build cast_unittest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed gyp files Created 7 years, 2 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/video_sender/video_encoder.cc ('k') | media/cast/video_sender/video_sender.cc » ('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 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/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/cast/cast_defines.h" 10 #include "media/cast/cast_defines.h"
(...skipping 28 matching lines...) Expand all
39 39
40 void DeliverEncodedVideoFrame(scoped_ptr<EncodedVideoFrame> encoded_frame, 40 void DeliverEncodedVideoFrame(scoped_ptr<EncodedVideoFrame> encoded_frame,
41 const base::TimeTicks& capture_time) { 41 const base::TimeTicks& capture_time) {
42 EXPECT_EQ(expected_key_frame_, encoded_frame->key_frame); 42 EXPECT_EQ(expected_key_frame_, encoded_frame->key_frame);
43 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id); 43 EXPECT_EQ(expected_frame_id_, encoded_frame->frame_id);
44 EXPECT_EQ(expected_last_referenced_frame_id_, 44 EXPECT_EQ(expected_last_referenced_frame_id_,
45 encoded_frame->last_referenced_frame_id); 45 encoded_frame->last_referenced_frame_id);
46 EXPECT_EQ(expected_capture_time_, capture_time); 46 EXPECT_EQ(expected_capture_time_, capture_time);
47 } 47 }
48 48
49 protected:
50 virtual ~TestVideoEncoderCallback() {}
51
49 private: 52 private:
53 friend class base::RefCountedThreadSafe<TestVideoEncoderCallback>;
54
50 bool expected_key_frame_; 55 bool expected_key_frame_;
51 uint8 expected_frame_id_; 56 uint8 expected_frame_id_;
52 uint8 expected_last_referenced_frame_id_; 57 uint8 expected_last_referenced_frame_id_;
53 base::TimeTicks expected_capture_time_; 58 base::TimeTicks expected_capture_time_;
54 }; 59 };
55 60
56 class VideoEncoderTest : public ::testing::Test { 61 class VideoEncoderTest : public ::testing::Test {
57 protected: 62 protected:
58 VideoEncoderTest() 63 VideoEncoderTest()
59 : pixels_(320 * 240, 123), 64 : pixels_(320 * 240, 123),
(...skipping 18 matching lines...) Expand all
78 video_frame_.y_plane.length = video_frame_.width; 83 video_frame_.y_plane.length = video_frame_.width;
79 video_frame_.y_plane.data = &(pixels_[0]); 84 video_frame_.y_plane.data = &(pixels_[0]);
80 video_frame_.u_plane.stride = video_frame_.width / 2; 85 video_frame_.u_plane.stride = video_frame_.width / 2;
81 video_frame_.u_plane.length = video_frame_.width / 2; 86 video_frame_.u_plane.length = video_frame_.width / 2;
82 video_frame_.u_plane.data = &(pixels_[0]); 87 video_frame_.u_plane.data = &(pixels_[0]);
83 video_frame_.v_plane.stride = video_frame_.width / 2; 88 video_frame_.v_plane.stride = video_frame_.width / 2;
84 video_frame_.v_plane.length = video_frame_.width / 2; 89 video_frame_.v_plane.length = video_frame_.width / 2;
85 video_frame_.v_plane.data = &(pixels_[0]); 90 video_frame_.v_plane.data = &(pixels_[0]);
86 } 91 }
87 92
88 ~VideoEncoderTest() {} 93 virtual ~VideoEncoderTest() {}
89 94
90 virtual void SetUp() { 95 virtual void SetUp() {
91 task_runner_ = new test::FakeTaskRunner(&testing_clock_); 96 task_runner_ = new test::FakeTaskRunner(&testing_clock_);
92 cast_thread_ = new CastThread(task_runner_, task_runner_, task_runner_, 97 cast_thread_ = new CastThread(task_runner_, task_runner_, task_runner_,
93 task_runner_, task_runner_); 98 task_runner_, task_runner_);
94 } 99 }
95 100
96 void Configure(uint8 max_unacked_frames) { 101 void Configure(uint8 max_unacked_frames) {
97 video_encoder_= new VideoEncoder(cast_thread_, video_config_, 102 video_encoder_= new VideoEncoder(cast_thread_, video_config_,
98 max_unacked_frames); 103 max_unacked_frames);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 for (int i = 5; i < 17; ++i) { 241 for (int i = 5; i < 17; ++i) {
237 test_video_encoder_callback_->SetExpectedResult(false, i, 4, capture_time); 242 test_video_encoder_callback_->SetExpectedResult(false, i, 4, capture_time);
238 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(&video_frame_, capture_time, 243 EXPECT_TRUE(video_encoder_->EncodeVideoFrame(&video_frame_, capture_time,
239 frame_encoded_callback, base::Bind(ReleaseFrame, &video_frame_))); 244 frame_encoded_callback, base::Bind(ReleaseFrame, &video_frame_)));
240 task_runner_->RunTasks(); 245 task_runner_->RunTasks();
241 } 246 }
242 } 247 }
243 248
244 } // namespace cast 249 } // namespace cast
245 } // namespace media 250 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_sender/video_encoder.cc ('k') | media/cast/video_sender/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698