OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 using ::testing::_; | 58 using ::testing::_; |
59 using ::testing::SaveArg; | 59 using ::testing::SaveArg; |
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_METHOD1(ReserveOutputBuffer, |
68 scoped_refptr<Buffer>(VideoFrame::Format format, | 68 scoped_refptr<Buffer>(const VideoCaptureFormat& format)); |
69 const gfx::Size& dimensions)); | |
70 MOCK_METHOD9(OnIncomingCapturedYuvData, | 69 MOCK_METHOD9(OnIncomingCapturedYuvData, |
71 void (const uint8* y_data, | 70 void (const uint8* y_data, |
72 const uint8* u_data, | 71 const uint8* u_data, |
73 const uint8* v_data, | 72 const uint8* v_data, |
74 size_t y_stride, | 73 size_t y_stride, |
75 size_t u_stride, | 74 size_t u_stride, |
76 size_t v_stride, | 75 size_t v_stride, |
77 const VideoCaptureFormat& frame_format, | 76 const VideoCaptureFormat& frame_format, |
78 int clockwise_rotation, | 77 int clockwise_rotation, |
79 const base::TimeTicks& timestamp)); | 78 const base::TimeTicks& timestamp)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 device_enumeration_listener_ = new DeviceEnumerationListener(); | 131 device_enumeration_listener_ = new DeviceEnumerationListener(); |
133 } | 132 } |
134 | 133 |
135 void SetUp() override { | 134 void SetUp() override { |
136 #if defined(OS_ANDROID) | 135 #if defined(OS_ANDROID) |
137 VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice( | 136 VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice( |
138 base::android::AttachCurrentThread()); | 137 base::android::AttachCurrentThread()); |
139 #endif | 138 #endif |
140 EXPECT_CALL(*client_, OnIncomingCapturedYuvData(_,_,_,_,_,_,_,_,_)) | 139 EXPECT_CALL(*client_, OnIncomingCapturedYuvData(_,_,_,_,_,_,_,_,_)) |
141 .Times(0); | 140 .Times(0); |
142 EXPECT_CALL(*client_, ReserveOutputBuffer(_,_)).Times(0); | 141 EXPECT_CALL(*client_, ReserveOutputBuffer(_)).Times(0); |
143 EXPECT_CALL(*client_, OnIncomingCapturedVideoFrame(_,_,_)).Times(0); | 142 EXPECT_CALL(*client_, OnIncomingCapturedVideoFrame(_,_,_)).Times(0); |
144 } | 143 } |
145 | 144 |
146 void ResetWithNewClient() { | 145 void ResetWithNewClient() { |
147 client_.reset(new MockClient(base::Bind( | 146 client_.reset(new MockClient(base::Bind( |
148 &VideoCaptureDeviceTest::OnFrameCaptured, base::Unretained(this)))); | 147 &VideoCaptureDeviceTest::OnFrameCaptured, base::Unretained(this)))); |
149 } | 148 } |
150 | 149 |
151 void OnFrameCaptured(const VideoCaptureFormat& format) { | 150 void OnFrameCaptured(const VideoCaptureFormat& format) { |
152 last_format_ = format; | 151 last_format_ = format; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 440 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
442 // GetDeviceSupportedFormats(). | 441 // GetDeviceSupportedFormats(). |
443 scoped_ptr<VideoCaptureDevice::Name> name = | 442 scoped_ptr<VideoCaptureDevice::Name> name = |
444 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 443 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
445 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 444 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
446 // since we cannot forecast the hardware capabilities. | 445 // since we cannot forecast the hardware capabilities. |
447 ASSERT_FALSE(name); | 446 ASSERT_FALSE(name); |
448 } | 447 } |
449 | 448 |
450 }; // namespace media | 449 }; // namespace media |
OLD | NEW |