OSDN Git Service

Merge "docs: Add documentation for equals() method" into qt-dev am: 732a127636
[android-x86/frameworks-base.git] / packages / SystemUI / tests / src / com / android / systemui / glwallpaper / EglHelperTest.java
1 /*
2  * Copyright (C) 2019 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 com.android.systemui.glwallpaper;
18
19 import static org.junit.Assert.*;
20 import static org.mockito.Mockito.RETURNS_DEFAULTS;
21 import static org.mockito.Mockito.mock;
22
23 import android.testing.AndroidTestingRunner;
24 import android.testing.TestableLooper;
25 import android.view.SurfaceHolder;
26
27 import androidx.test.filters.SmallTest;
28
29 import com.android.systemui.SysuiTestCase;
30
31 import org.junit.Before;
32 import org.junit.Test;
33 import org.junit.runner.RunWith;
34 import org.mockito.Mock;
35
36
37 @SmallTest
38 @RunWith(AndroidTestingRunner.class)
39 @TestableLooper.RunWithLooper
40 public class EglHelperTest extends SysuiTestCase {
41
42     @Mock
43     private EglHelper mEglHelper;
44     @Mock
45     private SurfaceHolder mSurfaceHolder;
46
47     @Before
48     public void setUp() throws Exception {
49         mEglHelper = mock(EglHelper.class, RETURNS_DEFAULTS);
50         mSurfaceHolder = mock(SurfaceHolder.class, RETURNS_DEFAULTS);
51     }
52
53     @Test
54     public void testInit_finish() {
55         mEglHelper.init(mSurfaceHolder);
56         mEglHelper.finish();
57     }
58
59     @Test
60     public void testFinish_shouldNotCrash() {
61         assertFalse(mEglHelper.hasEglDisplay());
62         assertFalse(mEglHelper.hasEglSurface());
63         assertFalse(mEglHelper.hasEglContext());
64
65         mEglHelper.finish();
66     }
67 }