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

Side by Side Diff: media/video/capture/video_capture_device_unittest.cc

Issue 1064963002: VideoCapture: add support for GpuMemoryBuffer allocation and lifetime mgmt in VideoCaptureBufferPool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 MOCK_METHOD9(OnIncomingCapturedYuvData, 70 MOCK_METHOD9(OnIncomingCapturedYuvData,
71 void (const uint8* y_data, 71 void (const uint8* y_data,
72 const uint8* u_data, 72 const uint8* u_data,
73 const uint8* v_data, 73 const uint8* v_data,
74 size_t y_stride, 74 size_t y_stride,
75 size_t u_stride, 75 size_t u_stride,
76 size_t v_stride, 76 size_t v_stride,
77 const VideoCaptureFormat& frame_format, 77 const VideoCaptureFormat& frame_format,
78 int clockwise_rotation, 78 int clockwise_rotation,
79 const base::TimeTicks& timestamp)); 79 const base::TimeTicks& timestamp));
80 MOCK_METHOD3(OnIncomingCapturedBuffer,
81 void(const scoped_refptr<Buffer>& buffer,
82 const VideoCaptureFormat& frame_format,
83 const base::TimeTicks& timestamp));
80 MOCK_METHOD3(OnIncomingCapturedVideoFrame, 84 MOCK_METHOD3(OnIncomingCapturedVideoFrame,
81 void(const scoped_refptr<Buffer>& buffer, 85 void(const scoped_refptr<Buffer>& buffer,
82 const scoped_refptr<VideoFrame>& frame, 86 const scoped_refptr<VideoFrame>& frame,
83 const base::TimeTicks& timestamp)); 87 const base::TimeTicks& timestamp));
84 MOCK_METHOD1(OnError, void(const std::string& reason)); 88 MOCK_METHOD1(OnError, void(const std::string& reason));
85 89
86 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) 90 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb)
87 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} 91 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {}
88 92
89 void OnIncomingCapturedData(const uint8* data, 93 void OnIncomingCapturedData(const uint8* data,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 137 }
134 138
135 void SetUp() override { 139 void SetUp() override {
136 #if defined(OS_ANDROID) 140 #if defined(OS_ANDROID)
137 VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice( 141 VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice(
138 base::android::AttachCurrentThread()); 142 base::android::AttachCurrentThread());
139 #endif 143 #endif
140 EXPECT_CALL(*client_, OnIncomingCapturedYuvData(_,_,_,_,_,_,_,_,_)) 144 EXPECT_CALL(*client_, OnIncomingCapturedYuvData(_,_,_,_,_,_,_,_,_))
141 .Times(0); 145 .Times(0);
142 EXPECT_CALL(*client_, ReserveOutputBuffer(_,_)).Times(0); 146 EXPECT_CALL(*client_, ReserveOutputBuffer(_,_)).Times(0);
147 EXPECT_CALL(*client_, OnIncomingCapturedBuffer(_,_,_)).Times(0);
143 EXPECT_CALL(*client_, OnIncomingCapturedVideoFrame(_,_,_)).Times(0); 148 EXPECT_CALL(*client_, OnIncomingCapturedVideoFrame(_,_,_)).Times(0);
144 } 149 }
145 150
146 void ResetWithNewClient() { 151 void ResetWithNewClient() {
147 client_.reset(new MockClient(base::Bind( 152 client_.reset(new MockClient(base::Bind(
148 &VideoCaptureDeviceTest::OnFrameCaptured, base::Unretained(this)))); 153 &VideoCaptureDeviceTest::OnFrameCaptured, base::Unretained(this))));
149 } 154 }
150 155
151 void OnFrameCaptured(const VideoCaptureFormat& format) { 156 void OnFrameCaptured(const VideoCaptureFormat& format) {
152 last_format_ = format; 157 last_format_ = format;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // Use PIXEL_FORMAT_MAX to iterate all device names for testing 446 // Use PIXEL_FORMAT_MAX to iterate all device names for testing
442 // GetDeviceSupportedFormats(). 447 // GetDeviceSupportedFormats().
443 scoped_ptr<VideoCaptureDevice::Name> name = 448 scoped_ptr<VideoCaptureDevice::Name> name =
444 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); 449 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX);
445 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here 450 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here
446 // since we cannot forecast the hardware capabilities. 451 // since we cannot forecast the hardware capabilities.
447 ASSERT_FALSE(name); 452 ASSERT_FALSE(name);
448 } 453 }
449 454
450 }; // namespace media 455 }; // namespace media
OLDNEW
« media/video/capture/video_capture_device.h ('K') | « media/video/capture/video_capture_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698