blob: ca648234a24eff6de00470e642ba94d388513ceb [file] [log] [blame]
phweiss679dc242017-07-05 18:54:54 +02001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the
10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11 * KIND, either express or implied. See the License for the specific language governing
12 * permissions and limitations under the License.
13 */
14
15package com.android.systemui.statusbar.phone;
16
17import static junit.framework.Assert.assertTrue;
Jason Monka716bac2018-12-05 15:48:21 -050018
phweiss679dc242017-07-05 18:54:54 +020019import static org.mockito.Matchers.any;
20import static org.mockito.Mockito.spy;
21import static org.mockito.Mockito.verify;
22
23import android.content.Context;
24import android.content.Intent;
25import android.content.IntentFilter;
phweiss679dc242017-07-05 18:54:54 +020026import android.testing.AndroidTestingRunner;
27import android.testing.TestableLooper.RunWithLooper;
28
Brett Chabot84151d92019-02-27 15:37:59 -080029import androidx.test.filters.SmallTest;
30
phweiss679dc242017-07-05 18:54:54 +020031import com.android.systemui.SysuiTestCase;
32
33import org.junit.Before;
34import org.junit.Test;
35import org.junit.runner.RunWith;
36import org.mockito.ArgumentCaptor;
37
phweiss679dc242017-07-05 18:54:54 +020038@RunWith(AndroidTestingRunner.class)
Jason Monka716bac2018-12-05 15:48:21 -050039@RunWithLooper
phweiss679dc242017-07-05 18:54:54 +020040@SmallTest
41public class SystemUIDialogTest extends SysuiTestCase {
42
43 private SystemUIDialog mDialog;
44
45 Context mContextSpy;
46
47 @Before
48 public void setup() {
49 mContextSpy = spy(mContext);
50 mDialog = new SystemUIDialog(mContextSpy);
51 }
52
53 @Test
54 public void testRegisterReceiver() {
55 final ArgumentCaptor<IntentFilter> intentFilterCaptor =
56 ArgumentCaptor.forClass(IntentFilter.class);
57
58 verify(mContextSpy).registerReceiverAsUser(any(), any(),
59 intentFilterCaptor.capture(), any(), any());
60
61 assertTrue(intentFilterCaptor.getValue().hasAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
62 }
63
64}