blob: 090963be7ac7914b25a26ecbc274eaf369950aae [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;
26import android.support.test.filters.SmallTest;
27import android.testing.AndroidTestingRunner;
28import android.testing.TestableLooper.RunWithLooper;
29
30import com.android.systemui.SysuiTestCase;
31
32import org.junit.Before;
33import org.junit.Test;
34import org.junit.runner.RunWith;
35import org.mockito.ArgumentCaptor;
36
37
38@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}