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

Side by Side Diff: content/renderer/media_capture_from_element/canvas_capture_handler_unittest.cc

Issue 2964923002: Remove unused VideoCapturerSource::GetCurrentSupportedFormats(). (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « no previous file | content/renderer/media_capture_from_element/html_video_element_capturer_source_unittest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "content/child/child_process.h" 9 #include "content/child/child_process.h"
10 #include "content/renderer/media/media_stream_video_capturer_source.h" 10 #include "content/renderer/media/media_stream_video_capturer_source.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 // Necessary callbacks and MOCK_METHODS for VideoCapturerSource. 69 // Necessary callbacks and MOCK_METHODS for VideoCapturerSource.
70 MOCK_METHOD2(DoOnDeliverFrame, 70 MOCK_METHOD2(DoOnDeliverFrame,
71 void(const scoped_refptr<media::VideoFrame>&, base::TimeTicks)); 71 void(const scoped_refptr<media::VideoFrame>&, base::TimeTicks));
72 void OnDeliverFrame(const scoped_refptr<media::VideoFrame>& video_frame, 72 void OnDeliverFrame(const scoped_refptr<media::VideoFrame>& video_frame,
73 base::TimeTicks estimated_capture_time) { 73 base::TimeTicks estimated_capture_time) {
74 DoOnDeliverFrame(video_frame, estimated_capture_time); 74 DoOnDeliverFrame(video_frame, estimated_capture_time);
75 } 75 }
76 76
77 MOCK_METHOD1(DoOnVideoCaptureDeviceFormats,
78 void(const media::VideoCaptureFormats&));
79 void OnVideoCaptureDeviceFormats(const media::VideoCaptureFormats& formats) {
80 DoOnVideoCaptureDeviceFormats(formats);
81 }
82
83 MOCK_METHOD1(DoOnRunning, void(bool)); 77 MOCK_METHOD1(DoOnRunning, void(bool));
84 void OnRunning(bool state) { DoOnRunning(state); } 78 void OnRunning(bool state) { DoOnRunning(state); }
85 79
86 // Verify returned frames. 80 // Verify returned frames.
87 static sk_sp<SkImage> GenerateTestImage(bool opaque, int width, int height) { 81 static sk_sp<SkImage> GenerateTestImage(bool opaque, int width, int height) {
88 SkBitmap testBitmap; 82 SkBitmap testBitmap;
89 testBitmap.allocN32Pixels(width, height, opaque); 83 testBitmap.allocN32Pixels(width, height, opaque);
90 testBitmap.eraseARGB(kTestAlphaValue, 30, 60, 200); 84 testBitmap.eraseARGB(kTestAlphaValue, 30, 60, 200);
91 return SkImage::MakeFromBitmap(testBitmap); 85 return SkImage::MakeFromBitmap(testBitmap);
92 } 86 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 InSequence s; 161 InSequence s;
168 const blink::WebMediaStreamSource& web_media_stream_source = track_.Source(); 162 const blink::WebMediaStreamSource& web_media_stream_source = track_.Source();
169 EXPECT_FALSE(web_media_stream_source.IsNull()); 163 EXPECT_FALSE(web_media_stream_source.IsNull());
170 MediaStreamVideoCapturerSource* const ms_source = 164 MediaStreamVideoCapturerSource* const ms_source =
171 static_cast<MediaStreamVideoCapturerSource*>( 165 static_cast<MediaStreamVideoCapturerSource*>(
172 web_media_stream_source.GetExtraData()); 166 web_media_stream_source.GetExtraData());
173 EXPECT_TRUE(ms_source != nullptr); 167 EXPECT_TRUE(ms_source != nullptr);
174 media::VideoCapturerSource* source = GetVideoCapturerSource(ms_source); 168 media::VideoCapturerSource* source = GetVideoCapturerSource(ms_source);
175 EXPECT_TRUE(source != nullptr); 169 EXPECT_TRUE(source != nullptr);
176 170
177 media::VideoCaptureFormats formats; 171 media::VideoCaptureFormats formats = source->GetPreferredFormats();
178 EXPECT_CALL(*this, DoOnVideoCaptureDeviceFormats(_))
179 .Times(1)
180 .WillOnce(SaveArg<0>(&formats));
181 source->GetCurrentSupportedFormats(
182 media::limits::kMaxCanvas /* max_requesteed_width */,
183 media::limits::kMaxCanvas /* max_requesteed_height */,
184 media::limits::kMaxFramesPerSecond /* max_requested_frame_rate */,
185 base::Bind(&CanvasCaptureHandlerTest::OnVideoCaptureDeviceFormats,
186 base::Unretained(this)));
187 ASSERT_EQ(2u, formats.size()); 172 ASSERT_EQ(2u, formats.size());
188 EXPECT_EQ(kTestCanvasCaptureWidth, formats[0].frame_size.width()); 173 EXPECT_EQ(kTestCanvasCaptureWidth, formats[0].frame_size.width());
189 EXPECT_EQ(kTestCanvasCaptureHeight, formats[0].frame_size.height()); 174 EXPECT_EQ(kTestCanvasCaptureHeight, formats[0].frame_size.height());
190 media::VideoCaptureParams params; 175 media::VideoCaptureParams params;
191 params.requested_format = formats[0]; 176 params.requested_format = formats[0];
192 177
193 base::RunLoop run_loop; 178 base::RunLoop run_loop;
194 base::Closure quit_closure = run_loop.QuitClosure(); 179 base::Closure quit_closure = run_loop.QuitClosure();
195 EXPECT_CALL(*this, DoOnRunning(true)).Times(1); 180 EXPECT_CALL(*this, DoOnRunning(true)).Times(1);
196 EXPECT_CALL(*this, DoOnDeliverFrame(_, _)) 181 EXPECT_CALL(*this, DoOnDeliverFrame(_, _))
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 INSTANTIATE_TEST_CASE_P( 233 INSTANTIATE_TEST_CASE_P(
249 , 234 ,
250 CanvasCaptureHandlerTest, 235 CanvasCaptureHandlerTest,
251 ::testing::Combine(::testing::Bool(), 236 ::testing::Combine(::testing::Bool(),
252 ::testing::Values(kTestCanvasCaptureFrameEvenSize, 237 ::testing::Values(kTestCanvasCaptureFrameEvenSize,
253 kTestCanvasCaptureFrameOddSize), 238 kTestCanvasCaptureFrameOddSize),
254 ::testing::Values(kTestCanvasCaptureFrameEvenSize, 239 ::testing::Values(kTestCanvasCaptureFrameEvenSize,
255 kTestCanvasCaptureFrameOddSize))); 240 kTestCanvasCaptureFrameOddSize)));
256 241
257 } // namespace content 242 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media_capture_from_element/html_video_element_capturer_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698