Commit de719226 authored by mcasas's avatar mcasas Committed by Commit bot

Reland: ImageCapture: Connect takePhoto() VideoCaptureDeviceTest

The original CL got reverted due to failing on a Lollipop bot. This
CL avoids Lollipops while investigations continue.

Original CL description ------------------------------------------------

This CL enables VideoCaptureDeviceTest.TakePhoto for
Android. (Note that, due to other circumstances, it'll
only be enabled for devices implementing the Camera2
API in non-legacy mode).

The only modification is that Android creates JPEGs
with APP1 JFIF header, because it includes EXIF information.

BUG=518807, 626857

TBR=emircan@chromium.org since the addec change is trivial.

Review-Url: https://codereview.chromium.org/2344683003
Cr-Commit-Position: refs/heads/master@{#419039}
parent 9dc06fa0
......@@ -38,6 +38,7 @@
#if defined(OS_ANDROID)
#include "base/android/jni_android.h"
#include "base/android/build_info.h"
#include "media/capture/video/android/video_capture_device_android.h"
#include "media/capture/video/android/video_capture_device_factory_android.h"
#endif
......@@ -55,7 +56,7 @@
#elif defined(OS_ANDROID)
#define MAYBE_AllocateBadSize AllocateBadSize
#define MAYBE_CaptureMjpeg CaptureMjpeg
#define MAYBE_TakePhoto DISABLED_TakePhoto
#define MAYBE_TakePhoto TakePhoto
#elif defined(OS_LINUX)
// AllocateBadSize will hang when a real camera is attached and if more than one
// test is trying to use the camera (even across processes). Do NOT renable
......@@ -148,7 +149,7 @@ class MockImageCaptureClient : public base::RefCounted<MockImageCaptureClient> {
EXPECT_EQ(0xFF, blob->data[0]); // First SOI byte
EXPECT_EQ(0xD8, blob->data[1]); // Second SOI byte
EXPECT_EQ(0xFF, blob->data[2]); // First JFIF-APP0 byte
EXPECT_EQ(0xE0, blob->data[3]); // Second JFIF-APP0 byte
EXPECT_EQ(0xE0, blob->data[3] & 0xF0); // Second JFIF-APP0/APP1 byte
OnCorrectPhotoTaken();
}
MOCK_METHOD0(OnCorrectPhotoTaken, void(void));
......@@ -509,6 +510,14 @@ TEST_F(VideoCaptureDeviceTest, MAYBE_TakePhoto) {
if (!EnumerateAndFindUsableDevices())
return;
#if defined(OS_ANDROID)
// TODO(mcasas): fails on Lollipop devices, reconnect https://crbug.com/646840
if (base::android::BuildInfo::GetInstance()->sdk_int() <
base::android::SDK_VERSION_MARSHMALLOW) {
return;
}
#endif
std::unique_ptr<VideoCaptureDevice> device(
video_capture_device_factory_->CreateDevice(
device_descriptors_->front()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment