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