1 /* 2 * Copyright 2015 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 package android.hardware.camera2.cts; 18 19 import android.hardware.cts.helpers.CameraParameterizedTestCase; 20 import android.util.Log; 21 22 import org.junit.runners.Parameterized; 23 import org.junit.runner.RunWith; 24 import org.junit.Test; 25 26 import static junit.framework.Assert.*; 27 28 /** 29 * <p>Basic test for CameraManager class.</p> 30 */ 31 32 @RunWith(Parameterized.class) 33 public class NativeCameraManagerTest extends CameraParameterizedTestCase { 34 private static final String TAG = "NativeCameraManagerTest"; 35 private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); 36 37 /** Load jni on initialization */ 38 static { 39 Log.i("NativeCameraManagerTest", "before loadlibrary"); 40 System.loadLibrary("ctscamera2_jni"); 41 Log.i("NativeCameraManagerTest", "after loadlibrary"); 42 } 43 44 @Test testCameraManagerGetAndClose()45 public void testCameraManagerGetAndClose() { 46 assertTrue("testCameraManagerGetAndClose fail, see log for details", 47 testCameraManagerGetAndCloseNative()); 48 } 49 50 @Test testCameraManagerGetCameraIds()51 public void testCameraManagerGetCameraIds() { 52 assertTrue("testCameraManagerGetCameraIds fail, see log for details", 53 testCameraManagerGetCameraIdsNative()); 54 } 55 56 @Test testCameraManagerAvailabilityCallback()57 public void testCameraManagerAvailabilityCallback() { 58 assertTrue("testCameraManagerAvailabilityCallback fail, see log for details", 59 testCameraManagerAvailabilityCallbackNative()); 60 } 61 62 @Test testCameraManagerExtendedAvailabilityCallback()63 public void testCameraManagerExtendedAvailabilityCallback() { 64 assertTrue("testCameraManagerExtendedAvailabilityCallback fail, see log for details", 65 testCameraManagerExtendedAvailabilityCallbackNative()); 66 } 67 68 @Test testCameraManagerCameraCharacteristics()69 public void testCameraManagerCameraCharacteristics() { 70 assertTrue("testCameraManagerCameraCharacteristics fail, see log for details", 71 testCameraManagerCharacteristicsNative()); 72 } 73 testCameraManagerGetAndCloseNative()74 private static native boolean testCameraManagerGetAndCloseNative(); testCameraManagerGetCameraIdsNative()75 private static native boolean testCameraManagerGetCameraIdsNative(); testCameraManagerAvailabilityCallbackNative()76 private static native boolean testCameraManagerAvailabilityCallbackNative(); testCameraManagerExtendedAvailabilityCallbackNative()77 private static native boolean testCameraManagerExtendedAvailabilityCallbackNative(); testCameraManagerCharacteristicsNative()78 private static native boolean testCameraManagerCharacteristicsNative(); 79 } 80