Add unit tests for class VideoCaptureDeviceMFWin |
|
Issue descriptionClass VideoCaptureDeviceMFWin has recently been reworked and we are planning to roll this implementation of media::VideoCaptureDevice out to users of Windows 8 and higher. Since the class contains a fair amount of complexity, we need to unit test it before we can roll it out with high confidence. Unit testing of this class can be done as follows: 1. Break dependency of the class on the actual Windows Media Foundation by abstracting all invocations of MediaFoundation APIs into an interface that gets passed into the constructor. 2. In the unit test, use a mock implementation of that abstraction.
,
Jan 29 2018
I was thinking of the first variant, i.e. creating a mock for IMFCaptureEngine and configuring it with behavior on multiple levels of depth. To save one level of depth, we can pass the IMFCaptureEngine into the VideoCaptureDeviceMFWin instance. All other global methods called by VideoCaptureDeviceMFWin, we can probably just leave as is, since mocking them is probably not needed to reach the interesting cases e.g. MFGetAttributeSize MFGetAttributeRatio MFCreateAttributes MFCreateMediaType PropVariantInit PropVariantClear
,
Feb 13 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c14a18060a8d798427f0ffa1fff17f3c5ffe5012 commit c14a18060a8d798427f0ffa1fff17f3c5ffe5012 Author: Réda Housni Alaoui <alaoui.rda@gmail.com> Date: Tue Feb 13 07:47:02 2018 Add unit tests for class VideoCaptureDeviceMFWin Bug: 786854 Change-Id: I6f51ed00b664d305166d092edd68891eaa0b7232 Reviewed-on: https://chromium-review.googlesource.com/890442 Commit-Queue: Christian Fremerey <chfremer@chromium.org> Reviewed-by: Christian Fremerey <chfremer@chromium.org> Cr-Commit-Position: refs/heads/master@{#536281} [modify] https://crrev.com/c14a18060a8d798427f0ffa1fff17f3c5ffe5012/media/capture/BUILD.gn [modify] https://crrev.com/c14a18060a8d798427f0ffa1fff17f3c5ffe5012/media/capture/video/win/video_capture_device_factory_win.cc [modify] https://crrev.com/c14a18060a8d798427f0ffa1fff17f3c5ffe5012/media/capture/video/win/video_capture_device_mf_win.cc [modify] https://crrev.com/c14a18060a8d798427f0ffa1fff17f3c5ffe5012/media/capture/video/win/video_capture_device_mf_win.h [add] https://crrev.com/c14a18060a8d798427f0ffa1fff17f3c5ffe5012/media/capture/video/win/video_capture_device_mf_win_unittest.cc |
|
►
Sign in to add a comment |
|
Comment 1 by alaoui....@gmail.com
, Jan 27 2018