Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 1 | /* |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 2 | * Copyright (C) 2019 The Android Open Source Project |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 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 |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 14 | * limitations under the License. |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 17 | package com.android.keyguard; |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 18 | |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 19 | import android.content.Context; |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 20 | import android.testing.AndroidTestingRunner; |
| 21 | import android.testing.TestableLooper; |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 22 | |
Brett Chabot | 84151d9 | 2019-02-27 15:37:59 -0800 | [diff] [blame] | 23 | import androidx.test.filters.SmallTest; |
| 24 | |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 25 | import com.android.keyguard.KeyguardDisplayManager.KeyguardPresentation; |
Robert Snoeberger | be35b76 | 2019-03-15 14:33:02 -0400 | [diff] [blame] | 26 | import com.android.systemui.SystemUIFactory; |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 27 | import com.android.systemui.SysuiTestCase; |
Robert Snoeberger | be35b76 | 2019-03-15 14:33:02 -0400 | [diff] [blame] | 28 | import com.android.systemui.util.InjectionInflationController; |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 29 | |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 30 | import org.junit.Test; |
| 31 | import org.junit.runner.RunWith; |
| 32 | |
| 33 | @SmallTest |
| 34 | @RunWith(AndroidTestingRunner.class) |
Jason Monk | a716bac | 2018-12-05 15:48:21 -0500 | [diff] [blame] | 35 | @TestableLooper.RunWithLooper |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 36 | public class KeyguardPresentationTest extends SysuiTestCase { |
| 37 | @Test |
| 38 | public void testInflation_doesntCrash() { |
Dave Mankoff | e229469 | 2019-08-14 11:53:13 -0400 | [diff] [blame] | 39 | mDependency.injectMockDependency(KeyguardUpdateMonitor.class); |
Beverly | 1467c9e | 2020-02-18 13:31:29 -0500 | [diff] [blame] | 40 | allowTestableLooperAsMainThread(); |
Robert Snoeberger | be35b76 | 2019-03-15 14:33:02 -0400 | [diff] [blame] | 41 | InjectionInflationController inflationController = new InjectionInflationController( |
| 42 | SystemUIFactory.getInstance().getRootComponent()); |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 43 | Context context = getContext(); |
Andrii Kulian | 5877c7d | 2020-01-29 16:57:32 -0800 | [diff] [blame^] | 44 | KeyguardPresentation keyguardPresentation = new KeyguardPresentation(context, |
| 45 | context.getDisplayNoVerify(), inflationController); |
Lucas Dupin | 7a27105 | 2019-05-27 22:33:32 -0700 | [diff] [blame] | 46 | keyguardPresentation.onCreate(null /*savedInstanceState */); |
Lucas Dupin | 0cf5e4a | 2018-05-02 00:33:17 -0700 | [diff] [blame] | 47 | } |
| 48 | } |