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

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

Issue 955253002: Add metadata to media::VideoFrame and plumb it through IPC/MediaStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi's nits addressed Created 5 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
« no previous file with comments | « media/video/capture/video_capture_device.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 namespace media { 61 namespace media {
62 62
63 namespace { 63 namespace {
64 64
65 class MockClient : public VideoCaptureDevice::Client { 65 class MockClient : public VideoCaptureDevice::Client {
66 public: 66 public:
67 MOCK_METHOD2(ReserveOutputBuffer, 67 MOCK_METHOD2(ReserveOutputBuffer,
68 scoped_refptr<Buffer>(VideoFrame::Format format, 68 scoped_refptr<Buffer>(VideoFrame::Format format,
69 const gfx::Size& dimensions)); 69 const gfx::Size& dimensions));
70 MOCK_METHOD4(OnIncomingCapturedVideoFrame, 70 MOCK_METHOD3(OnIncomingCapturedVideoFrame,
71 void(const scoped_refptr<Buffer>& buffer, 71 void(const scoped_refptr<Buffer>& buffer,
72 const VideoCaptureFormat& buffer_format,
73 const scoped_refptr<VideoFrame>& frame, 72 const scoped_refptr<VideoFrame>& frame,
74 const base::TimeTicks& timestamp)); 73 const base::TimeTicks& timestamp));
75 MOCK_METHOD1(OnError, void(const std::string& reason)); 74 MOCK_METHOD1(OnError, void(const std::string& reason));
76 75
77 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) 76 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb)
78 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {} 77 : main_thread_(base::MessageLoopProxy::current()), frame_cb_(frame_cb) {}
79 78
80 void OnIncomingCapturedData(const uint8* data, 79 void OnIncomingCapturedData(const uint8* data,
81 int length, 80 int length,
82 const VideoCaptureFormat& format, 81 const VideoCaptureFormat& format,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 base::MessageLoopProxy::current())) { 121 base::MessageLoopProxy::current())) {
123 device_enumeration_listener_ = new DeviceEnumerationListener(); 122 device_enumeration_listener_ = new DeviceEnumerationListener();
124 } 123 }
125 124
126 void SetUp() override { 125 void SetUp() override {
127 #if defined(OS_ANDROID) 126 #if defined(OS_ANDROID)
128 VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice( 127 VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice(
129 base::android::AttachCurrentThread()); 128 base::android::AttachCurrentThread());
130 #endif 129 #endif
131 EXPECT_CALL(*client_, ReserveOutputBuffer(_,_)).Times(0); 130 EXPECT_CALL(*client_, ReserveOutputBuffer(_,_)).Times(0);
132 EXPECT_CALL(*client_, OnIncomingCapturedVideoFrame(_,_,_,_)).Times(0); 131 EXPECT_CALL(*client_, OnIncomingCapturedVideoFrame(_,_,_)).Times(0);
133 } 132 }
134 133
135 void ResetWithNewClient() { 134 void ResetWithNewClient() {
136 client_.reset(new MockClient(base::Bind( 135 client_.reset(new MockClient(base::Bind(
137 &VideoCaptureDeviceTest::OnFrameCaptured, base::Unretained(this)))); 136 &VideoCaptureDeviceTest::OnFrameCaptured, base::Unretained(this))));
138 } 137 }
139 138
140 void OnFrameCaptured(const VideoCaptureFormat& format) { 139 void OnFrameCaptured(const VideoCaptureFormat& format) {
141 last_format_ = format; 140 last_format_ = format;
142 run_loop_->QuitClosure().Run(); 141 run_loop_->QuitClosure().Run();
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // Use PIXEL_FORMAT_MAX to iterate all device names for testing 428 // Use PIXEL_FORMAT_MAX to iterate all device names for testing
430 // GetDeviceSupportedFormats(). 429 // GetDeviceSupportedFormats().
431 scoped_ptr<VideoCaptureDevice::Name> name = 430 scoped_ptr<VideoCaptureDevice::Name> name =
432 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); 431 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX);
433 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here 432 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here
434 // since we cannot forecast the hardware capabilities. 433 // since we cannot forecast the hardware capabilities.
435 ASSERT_FALSE(name); 434 ASSERT_FALSE(name);
436 } 435 }
437 436
438 }; // namespace media 437 }; // namespace media
OLDNEW
« no previous file with comments | « 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