1 /* 2 * Copyright 2017 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.media.cts; 18 19 import android.platform.test.annotations.AppModeFull; 20 import android.test.AndroidTestCase; 21 import android.util.Log; 22 import android.view.Surface; 23 24 /** 25 * Verification test for AImageReader. 26 */ 27 @AppModeFull(reason = "TODO: evaluate and port to instant") 28 public class NativeImageReaderTest extends AndroidTestCase { 29 private static final String TAG = "NativeImageReaderTest"; 30 private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); 31 32 /** Load jni on initialization */ 33 static { 34 Log.i("NativeImageReaderTest", "before loadlibrary"); 35 System.loadLibrary("ctsimagereader_jni"); 36 Log.i("NativeImageReaderTest", "after loadlibrary"); 37 } 38 testSucceedsWithSupportedUsageFormat()39 public void testSucceedsWithSupportedUsageFormat() { 40 assertTrue( 41 "Native test failed, see log for details", 42 testSucceedsWithSupportedUsageFormatNative()); 43 } 44 testTakePictures()45 public void testTakePictures() { 46 assertTrue("Native test failed, see log for details", testTakePicturesNative()); 47 } 48 testCreateSurface()49 public void testCreateSurface() { 50 Surface surface = testCreateSurfaceNative(); 51 assertNotNull("Surface created is null.", surface); 52 assertTrue("Surface created is invalid.", surface.isValid()); 53 } 54 testSucceedsWithSupportedUsageFormatNative()55 private static native boolean testSucceedsWithSupportedUsageFormatNative(); testTakePicturesNative()56 private static native boolean testTakePicturesNative(); testCreateSurfaceNative()57 private static native Surface testCreateSurfaceNative(); 58 } 59