|
|
DescriptionVideo capture Android: enable unittests for Camera2 API
This CL reenables a bunch of VideoCaptureDeviceTest
test cases for Android and for the "new" APIs
For this:
- adds a |mTestMode| to VideoCapture.java, interface
of all camera java classes. VCCamera2.java tests this
flag and adds a capture thread if it's set.
- the C++ correspondent classes get a method to configure
the java side for testing, and a method to test if the
underlying platform is using the new or the old APIs.
Also:
- Removes DeAllocateCameraWhileRunning because it was
equivalent to CaptureWithSize test case.
- Cleans up/refactors some parts of the unit tests, adds
a few more comments etc
BUG=626857
Committed: https://crrev.com/7c32b70068c65b7bb372bb52a33d70b8e6653129
Cr-Commit-Position: refs/heads/master@{#417015}
Patch Set 1 : #
Total comments: 8
Patch Set 2 : jbudorick@s comments #
Total comments: 6
Patch Set 3 : emircan@ comments #
Total comments: 2
Patch Set 4 : jbudorick@ comment: Stopping mMainHandler thread in test mode #Patch Set 5 : Addressing mem leak. Rebase #Messages
Total messages: 42 (23 generated)
Patchset #1 (id:1) has been deleted
Description was changed from ========== Video capture Android: enable unittests for Camera2 API BUG=626857 ========== to ========== Video capture Android: enable unittests for Camera2 API This CL reenables a bunch of VideoCaptureDeviceTest test cases for Android and for the "new" APIs For this: - adds a |mTestMode| to VideoCapture.java, interface of all camera java classes. VCCamera2.java tests this flag and adds a capture thread if it's set. - the C++ correspondent classes get a method to configure the java side for testing, and a method to test if the underlying platform is using the new or the old APIs. Also: - Removes DeAllocateCameraWhileRunning because it was equivalent to CaptureWithSize test case. - Cleans up/refactors some parts of the unit tests, adds a few more comments etc BUG=626857 ==========
Patchset #1 (id:20001) has been deleted
mcasas@chromium.org changed reviewers: + jbudorick@chromium.org
jbudorick@ please take a first look
mcasas@chromium.org changed reviewers: + emircan@chromium.org
jbudorick@ ping emircan@ PTAL
https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/and... File media/capture/video/android/java/src/org/chromium/media/VideoCapture.java (right): https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/and... media/capture/video/android/java/src/org/chromium/media/VideoCapture.java:37: protected boolean mTestMode = true; nit: name this more specifically, something like mUseBackgroundThreadForTesting or something like that. https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... File media/capture/video/video_capture_device_unittest.cc (left): https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... media/capture/video/video_capture_device_unittest.cc:453: TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) { ? https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... File media/capture/video/video_capture_device_unittest.cc (right): https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... media/capture/video/video_capture_device_unittest.cc:102: ASSERT_TRUE(!!data); nit: what's with this change? !! appears to be very uncommon in chromium tests... https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... media/capture/video/video_capture_device_unittest.cc:228: bool EnumerateDeviceDescriptors() { Why did you switch this to return a bool rather than just returning a null unique_ptr or an empty instance of VideoCaptureDeviceDescriptors if any of the devices are legacy or deprecated? Having device_descriptors_ assigned in here seems more confusing than the previous implementation.
Patchset #2 (id:60001) has been deleted
PTAL https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/and... File media/capture/video/android/java/src/org/chromium/media/VideoCapture.java (right): https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/and... media/capture/video/android/java/src/org/chromium/media/VideoCapture.java:37: protected boolean mTestMode = true; On 2016/09/01 18:46:41, jbudorick wrote: > nit: name this more specifically, something like mUseBackgroundThreadForTesting > or something like that. Done. Also, it should be false by default. https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... File media/capture/video/video_capture_device_unittest.cc (left): https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... media/capture/video/video_capture_device_unittest.cc:453: TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) { On 2016/09/01 18:46:41, jbudorick wrote: > ? Like it says in the CL description... "Removes DeAllocateCameraWhileRunning because it was equivalent to CaptureWithSize test case." https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... File media/capture/video/video_capture_device_unittest.cc (right): https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... media/capture/video/video_capture_device_unittest.cc:102: ASSERT_TRUE(!!data); On 2016/09/01 18:46:41, jbudorick wrote: > nit: what's with this change? !! appears to be very uncommon in chromium > tests... Yeah, my bad; this comes from msvc compiler having troubles with if (bla) where bla is a pointer. If the bots are happy, so am I. https://codereview.chromium.org/2286303003/diff/40001/media/capture/video/vid... media/capture/video/video_capture_device_unittest.cc:228: bool EnumerateDeviceDescriptors() { On 2016/09/01 18:46:41, jbudorick wrote: > Why did you switch this to return a bool rather than just returning a null > unique_ptr or an empty instance of VideoCaptureDeviceDescriptors if any of the > devices are legacy or deprecated? Having device_descriptors_ assigned in here > seems more confusing than the previous implementation. It didn't make a lot of sense to have a member method returning the list just to force the individual call sites to update a member variable; the member variable had to be tested then individually at those call sites, and that was verbose and cluttered the test intentions. Actually, I'll even bring more code into this method and return true if there are usable |device_desciptors_|, and rename accordingly.
Patchset #2 (id:80001) has been deleted
https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... File media/capture/video/android/video_capture_device_factory_android.cc (right): https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... media/capture/video/android/video_capture_device_factory_android.cc:122: break; Why is this change? This would push_back the format to supported list with wrong |pixel_format|. https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... File media/capture/video/android/video_capture_device_factory_android.h (right): https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... media/capture/video/android/video_capture_device_factory_android.h:38: void ConfigureForTesting() { test_mode_ = true; } Note that this needs to be called before CreateDevice(). https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/vi... File media/capture/video/video_capture_device_unittest.cc (right): https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/vi... media/capture/video/video_capture_device_unittest.cc:390: // captured Fix indentation.
jbudorick@ ping emircan@ PTAL
PTAL https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... File media/capture/video/android/video_capture_device_factory_android.cc (right): https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... media/capture/video/android/video_capture_device_factory_android.cc:122: break; On 2016/09/02 22:00:23, emircan wrote: > Why is this change? This would push_back the format to supported list with wrong > |pixel_format|. Camera2 does not know the Pixel format at this stage, so we're just not enumerating any formats on ToT for Android VideoCaptureDevices. At the enumeration state, PIXEL_FORMAT_UNKNOWN is OK, it simply means that the platform, well, doesn't know :) https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... File media/capture/video/android/video_capture_device_factory_android.h (right): https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/an... media/capture/video/android/video_capture_device_factory_android.h:38: void ConfigureForTesting() { test_mode_ = true; } On 2016/09/02 22:00:23, emircan wrote: > Note that this needs to be called before CreateDevice(). Added a comment. https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/vi... File media/capture/video/video_capture_device_unittest.cc (right): https://codereview.chromium.org/2286303003/diff/100001/media/capture/video/vi... media/capture/video/video_capture_device_unittest.cc:390: // captured On 2016/09/02 22:00:23, emircan wrote: > Fix indentation. Done.
lgtm
https://codereview.chromium.org/2286303003/diff/120001/media/capture/video/an... File media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java (right): https://codereview.chromium.org/2286303003/diff/120001/media/capture/video/an... media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java:540: thread.start(); Do we stop this thread at any point?
PTAL https://codereview.chromium.org/2286303003/diff/120001/media/capture/video/an... File media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java (right): https://codereview.chromium.org/2286303003/diff/120001/media/capture/video/an... media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java:540: thread.start(); On 2016/09/06 18:44:23, jbudorick wrote: > Do we stop this thread at any point? Now we do (its Looper, since Thread.quit() and stop() are discouraged).
lgtm
The CQ bit was checked by mcasas@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from emircan@chromium.org Link to the patchset: https://codereview.chromium.org/2286303003/#ps140001 (title: "jbudorick@ comment: Stopping mMainHandler thread in test mode")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by mcasas@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #5 (id:160001) has been deleted
Patchset #5 (id:180001) has been deleted
Patchset #5 (id:200001) has been deleted
The CQ bit was checked by mcasas@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by mcasas@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from emircan@chromium.org, jbudorick@chromium.org Link to the patchset: https://codereview.chromium.org/2286303003/#ps220001 (title: "Addressing mem leak. Rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Video capture Android: enable unittests for Camera2 API This CL reenables a bunch of VideoCaptureDeviceTest test cases for Android and for the "new" APIs For this: - adds a |mTestMode| to VideoCapture.java, interface of all camera java classes. VCCamera2.java tests this flag and adds a capture thread if it's set. - the C++ correspondent classes get a method to configure the java side for testing, and a method to test if the underlying platform is using the new or the old APIs. Also: - Removes DeAllocateCameraWhileRunning because it was equivalent to CaptureWithSize test case. - Cleans up/refactors some parts of the unit tests, adds a few more comments etc BUG=626857 ========== to ========== Video capture Android: enable unittests for Camera2 API This CL reenables a bunch of VideoCaptureDeviceTest test cases for Android and for the "new" APIs For this: - adds a |mTestMode| to VideoCapture.java, interface of all camera java classes. VCCamera2.java tests this flag and adds a capture thread if it's set. - the C++ correspondent classes get a method to configure the java side for testing, and a method to test if the underlying platform is using the new or the old APIs. Also: - Removes DeAllocateCameraWhileRunning because it was equivalent to CaptureWithSize test case. - Cleans up/refactors some parts of the unit tests, adds a few more comments etc BUG=626857 ==========
Message was sent while issue was closed.
Committed patchset #5 (id:220001)
Message was sent while issue was closed.
Description was changed from ========== Video capture Android: enable unittests for Camera2 API This CL reenables a bunch of VideoCaptureDeviceTest test cases for Android and for the "new" APIs For this: - adds a |mTestMode| to VideoCapture.java, interface of all camera java classes. VCCamera2.java tests this flag and adds a capture thread if it's set. - the C++ correspondent classes get a method to configure the java side for testing, and a method to test if the underlying platform is using the new or the old APIs. Also: - Removes DeAllocateCameraWhileRunning because it was equivalent to CaptureWithSize test case. - Cleans up/refactors some parts of the unit tests, adds a few more comments etc BUG=626857 ========== to ========== Video capture Android: enable unittests for Camera2 API This CL reenables a bunch of VideoCaptureDeviceTest test cases for Android and for the "new" APIs For this: - adds a |mTestMode| to VideoCapture.java, interface of all camera java classes. VCCamera2.java tests this flag and adds a capture thread if it's set. - the C++ correspondent classes get a method to configure the java side for testing, and a method to test if the underlying platform is using the new or the old APIs. Also: - Removes DeAllocateCameraWhileRunning because it was equivalent to CaptureWithSize test case. - Cleans up/refactors some parts of the unit tests, adds a few more comments etc BUG=626857 Committed: https://crrev.com/7c32b70068c65b7bb372bb52a33d70b8e6653129 Cr-Commit-Position: refs/heads/master@{#417015} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/7c32b70068c65b7bb372bb52a33d70b8e6653129 Cr-Commit-Position: refs/heads/master@{#417015}
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:220001) has been created in https://codereview.chromium.org/2320873002/ by aelias@chromium.org. The reason for reverting is: Caused WebViewLayoutTest#testMediaStreamApi and MediaAccessPermissionRequestTest#testGrantAccess to consistently fail. Confirmed locally by reverting patch, commenting out @DisableIf and running: ninja -C out/Release android_webview_test_apk android_webview_apk && out/Release/bin/run_android_webview_test_apk -f MediaAccessPermissionRequestTest.* BUG=644910. |