blob: 7231b8a143d0cf73503c14124540cfe626635d39 [file] [log] [blame]
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -07001/*
Lucas Dupin7a271052019-05-27 22:33:32 -07002 * Copyright (C) 2019 The Android Open Source Project
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -07003 *
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 Dupin7a271052019-05-27 22:33:32 -070014 * limitations under the License.
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070015 */
16
Lucas Dupin7a271052019-05-27 22:33:32 -070017package com.android.keyguard;
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070018
Lucas Dupin7a271052019-05-27 22:33:32 -070019import android.content.Context;
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070020import android.testing.AndroidTestingRunner;
21import android.testing.TestableLooper;
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070022
Brett Chabot84151d92019-02-27 15:37:59 -080023import androidx.test.filters.SmallTest;
24
Lucas Dupin7a271052019-05-27 22:33:32 -070025import com.android.keyguard.KeyguardDisplayManager.KeyguardPresentation;
Robert Snoebergerbe35b762019-03-15 14:33:02 -040026import com.android.systemui.SystemUIFactory;
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070027import com.android.systemui.SysuiTestCase;
Robert Snoebergerbe35b762019-03-15 14:33:02 -040028import com.android.systemui.util.InjectionInflationController;
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070029
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070030import org.junit.Test;
31import org.junit.runner.RunWith;
32
33@SmallTest
34@RunWith(AndroidTestingRunner.class)
Jason Monka716bac2018-12-05 15:48:21 -050035@TestableLooper.RunWithLooper
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070036public class KeyguardPresentationTest extends SysuiTestCase {
37 @Test
38 public void testInflation_doesntCrash() {
Dave Mankoffe2294692019-08-14 11:53:13 -040039 mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
Beverly1467c9e2020-02-18 13:31:29 -050040 allowTestableLooperAsMainThread();
Robert Snoebergerbe35b762019-03-15 14:33:02 -040041 InjectionInflationController inflationController = new InjectionInflationController(
42 SystemUIFactory.getInstance().getRootComponent());
Lucas Dupin7a271052019-05-27 22:33:32 -070043 Context context = getContext();
Andrii Kulian5877c7d2020-01-29 16:57:32 -080044 KeyguardPresentation keyguardPresentation = new KeyguardPresentation(context,
45 context.getDisplayNoVerify(), inflationController);
Lucas Dupin7a271052019-05-27 22:33:32 -070046 keyguardPresentation.onCreate(null /*savedInstanceState */);
Lucas Dupin0cf5e4a2018-05-02 00:33:17 -070047 }
48}