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

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

Issue 276383002: VideoCaptureDeviceWin: Extract class-static method into a Factory (both MF/DS) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased factory win. Created 6 years, 7 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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "media/video/capture/video_capture_device.h" 11 #include "media/video/capture/video_capture_device.h"
12 #include "media/video/capture/video_capture_device_factory.h" 12 #include "media/video/capture/video_capture_device_factory.h"
13 #include "media/video/capture/video_capture_types.h" 13 #include "media/video/capture/video_capture_types.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 #if defined(OS_WIN) 17 #if defined(OS_WIN)
18 #include "base/win/scoped_com_initializer.h" 18 #include "base/win/scoped_com_initializer.h"
19 #include "media/video/capture/win/video_capture_device_mf_win.h" 19 #include "media/video/capture/win/video_capture_device_factory_win.h"
20 #endif 20 #endif
21 21
22 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
23 #include "base/android/jni_android.h" 23 #include "base/android/jni_android.h"
24 #include "media/video/capture/android/video_capture_device_android.h" 24 #include "media/video/capture/android/video_capture_device_android.h"
25 #endif 25 #endif
26 26
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 // Mac/QTKit will always give you the size you ask for and this case will fail. 28 // Mac/QTKit will always give you the size you ask for and this case will fail.
29 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize 29 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 scoped_ptr<base::MessageLoop> loop_; 158 scoped_ptr<base::MessageLoop> loop_;
159 scoped_ptr<base::RunLoop> run_loop_; 159 scoped_ptr<base::RunLoop> run_loop_;
160 scoped_ptr<MockClient> client_; 160 scoped_ptr<MockClient> client_;
161 VideoCaptureFormat last_format_; 161 VideoCaptureFormat last_format_;
162 scoped_ptr<VideoCaptureDeviceFactory> video_capture_device_factory_; 162 scoped_ptr<VideoCaptureDeviceFactory> video_capture_device_factory_;
163 }; 163 };
164 164
165 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { 165 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) {
166 #if defined(OS_WIN) 166 #if defined(OS_WIN)
167 VideoCaptureDevice::Name::CaptureApiType api_type = 167 VideoCaptureDevice::Name::CaptureApiType api_type =
168 VideoCaptureDeviceMFWin::PlatformSupported() 168 VideoCaptureDeviceFactoryWin::PlatformSupportsMediaFoundation()
169 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION 169 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION
170 : VideoCaptureDevice::Name::DIRECT_SHOW; 170 : VideoCaptureDevice::Name::DIRECT_SHOW;
171 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type); 171 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type);
172 #elif defined(OS_MACOSX) 172 #elif defined(OS_MACOSX)
173 VideoCaptureDevice::Name device_name("jibberish", "jibberish", 173 VideoCaptureDevice::Name device_name("jibberish", "jibberish",
174 VideoCaptureDevice::Name::AVFOUNDATION); 174 VideoCaptureDevice::Name::AVFOUNDATION);
175 #else 175 #else
176 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); 176 VideoCaptureDevice::Name device_name("jibberish", "jibberish");
177 #endif 177 #endif
178 scoped_ptr<VideoCaptureDevice> device = 178 scoped_ptr<VideoCaptureDevice> device =
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Use PIXEL_FORMAT_MAX to iterate all device names for testing 373 // Use PIXEL_FORMAT_MAX to iterate all device names for testing
374 // GetDeviceSupportedFormats(). 374 // GetDeviceSupportedFormats().
375 scoped_ptr<VideoCaptureDevice::Name> name = 375 scoped_ptr<VideoCaptureDevice::Name> name =
376 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); 376 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX);
377 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here 377 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here
378 // since we cannot forecast the hardware capabilities. 378 // since we cannot forecast the hardware capabilities.
379 ASSERT_FALSE(name); 379 ASSERT_FALSE(name);
380 } 380 }
381 381
382 }; // namespace media 382 }; // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/video_capture_device_factory.cc ('k') | media/video/capture/win/video_capture_device_factory_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698