blob: cff839431a90ff68d58affe4a9510df86cf470d8 [file] [log] [blame]
Igor Murashkine302ee32012-11-05 11:14:49 -08001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <gtest/gtest.h>
18
Igor Murashkineab33fc2012-11-06 17:02:54 -080019#define LOG_TAG "CameraStreamTest"
Igor Murashkine302ee32012-11-05 11:14:49 -080020#define LOG_NDEBUG 0
21#include <utils/Log.h>
22
23#include "hardware/hardware.h"
24#include "hardware/camera2.h"
25
26#include "Camera2Device.h"
27#include "utils/StrongPointer.h"
28
29#include <gui/CpuConsumer.h>
30#include <gui/SurfaceTextureClient.h>
31
32#include "CameraStreamFixture.h"
Igor Murashkineab33fc2012-11-06 17:02:54 -080033#include "TestExtensions.h"
Igor Murashkine302ee32012-11-05 11:14:49 -080034
35using namespace android;
36using namespace android::camera2;
37
38namespace android {
39namespace camera2 {
40namespace tests {
41
Igor Murashkineab33fc2012-11-06 17:02:54 -080042class CameraStreamTest
Igor Murashkine302ee32012-11-05 11:14:49 -080043 : public ::testing::TestWithParam<CameraStreamParams>,
44 public CameraStreamFixture {
45
46public:
Igor Murashkineab33fc2012-11-06 17:02:54 -080047 CameraStreamTest() : CameraStreamFixture(GetParam()) {
48 TEST_EXTENSION_FORKING_CONSTRUCTOR;
Igor Murashkine302ee32012-11-05 11:14:49 -080049 }
50
Igor Murashkineab33fc2012-11-06 17:02:54 -080051 ~CameraStreamTest() {
52 TEST_EXTENSION_FORKING_DESTRUCTOR;
Igor Murashkine302ee32012-11-05 11:14:49 -080053 }
54
55 virtual void SetUp() {
Igor Murashkineab33fc2012-11-06 17:02:54 -080056 TEST_EXTENSION_FORKING_SET_UP;
Igor Murashkine302ee32012-11-05 11:14:49 -080057 }
58 virtual void TearDown() {
Igor Murashkineab33fc2012-11-06 17:02:54 -080059 TEST_EXTENSION_FORKING_TEAR_DOWN;
Igor Murashkine302ee32012-11-05 11:14:49 -080060 }
61
62protected:
63
64};
65
Igor Murashkineab33fc2012-11-06 17:02:54 -080066TEST_P(CameraStreamTest, CreateStream) {
Igor Murashkine302ee32012-11-05 11:14:49 -080067
Igor Murashkineab33fc2012-11-06 17:02:54 -080068 TEST_EXTENSION_FORKING_INIT;
Igor Murashkine302ee32012-11-05 11:14:49 -080069
Igor Murashkineab33fc2012-11-06 17:02:54 -080070 ASSERT_NO_FATAL_FAILURE(CreateStream());
71 ASSERT_NO_FATAL_FAILURE(DeleteStream());
Igor Murashkine302ee32012-11-05 11:14:49 -080072}
73
74//TODO: use a combinatoric generator
75static CameraStreamParams TestParameters[] = {
76 {
Igor Murashkine302ee32012-11-05 11:14:49 -080077 /*mFormat*/ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
78 /*mHeapCount*/ 1
79 },
80 {
Igor Murashkine302ee32012-11-05 11:14:49 -080081 /*mFormat*/ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
82 /*mHeapCount*/ 2
83 },
84 {
Igor Murashkine302ee32012-11-05 11:14:49 -080085 /*mFormat*/ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
86 /*mHeapCount*/ 3
87 },
88 {
Igor Murashkine302ee32012-11-05 11:14:49 -080089 /*mFormat*/ HAL_PIXEL_FORMAT_YCrCb_420_SP, // NV21
90 /*mHeapCount*/ 1
91 },
92 {
Igor Murashkine302ee32012-11-05 11:14:49 -080093 /*mFormat*/ HAL_PIXEL_FORMAT_YCrCb_420_SP,
94 /*mHeapCount*/ 2
95 },
96 {
Igor Murashkine302ee32012-11-05 11:14:49 -080097 /*mFormat*/ HAL_PIXEL_FORMAT_YCrCb_420_SP,
98 /*mHeapCount*/ 3
99 },
100 {
Igor Murashkine302ee32012-11-05 11:14:49 -0800101 /*mFormat*/ HAL_PIXEL_FORMAT_YV12,
102 /*mHeapCount*/ 1
103 },
104 {
Igor Murashkine302ee32012-11-05 11:14:49 -0800105 /*mFormat*/ HAL_PIXEL_FORMAT_YV12,
106 /*mHeapCount*/ 2
107 },
108 {
Igor Murashkine302ee32012-11-05 11:14:49 -0800109 /*mFormat*/ HAL_PIXEL_FORMAT_YV12,
110 /*mHeapCount*/ 3
111 },
112 {
Igor Murashkine302ee32012-11-05 11:14:49 -0800113 /*mFormat*/ HAL_PIXEL_FORMAT_RAW_SENSOR,
114 /*mHeapCount*/ 1
115 },
116 {
Igor Murashkine302ee32012-11-05 11:14:49 -0800117 /*mFormat*/ HAL_PIXEL_FORMAT_RAW_SENSOR,
118 /*mHeapCount*/ 2
119 },
120 {
Igor Murashkine302ee32012-11-05 11:14:49 -0800121 /*mFormat*/ HAL_PIXEL_FORMAT_RAW_SENSOR,
122 /*mHeapCount*/ 3
123 },
124};
125
Igor Murashkineab33fc2012-11-06 17:02:54 -0800126INSTANTIATE_TEST_CASE_P(StreamParameterCombinations, CameraStreamTest,
Igor Murashkine302ee32012-11-05 11:14:49 -0800127 testing::ValuesIn(TestParameters));
128
129
130}
131}
132}
133