• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.settings.panel;
18 
19 import static com.google.common.truth.Truth.assertThat;
20 
21 import static org.mockito.Mockito.spy;
22 import static org.mockito.Mockito.when;
23 
24 import android.content.Context;
25 import android.net.Uri;
26 
27 import com.android.settings.slices.CustomSliceRegistry;
28 
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.junit.runner.RunWith;
32 import org.mockito.MockitoAnnotations;
33 import org.robolectric.RobolectricTestRunner;
34 import org.robolectric.RuntimeEnvironment;
35 
36 import java.util.List;
37 
38 @RunWith(RobolectricTestRunner.class)
39 public class VolumePanelTest {
40 
41     private VolumePanel mPanel;
42     private Context mContext;
43 
44 
45     @Before
setUp()46     public void setUp() {
47         MockitoAnnotations.initMocks(this);
48 
49         mContext = spy(RuntimeEnvironment.application);
50 
51         when(mContext.getApplicationContext()).thenReturn(mContext);
52 
53         mPanel = VolumePanel.create(mContext);
54     }
55 
56     @Test
getSlices_checkUri()57     public void getSlices_checkUri() {
58         final List<Uri> uris = mPanel.getSlices();
59 
60         assertThat(uris).containsExactly(
61                 CustomSliceRegistry.REMOTE_MEDIA_SLICE_URI,
62                 CustomSliceRegistry.VOLUME_CALL_URI,
63                 CustomSliceRegistry.VOLUME_MEDIA_URI,
64                 CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_URI,
65                 CustomSliceRegistry.VOLUME_RINGER_URI,
66                 CustomSliceRegistry.VOLUME_SEPARATE_RING_URI,
67                 CustomSliceRegistry.VOLUME_NOTIFICATION_URI,
68                 CustomSliceRegistry.VOLUME_ALARM_URI);
69     }
70 
71     @Test
getSeeMoreIntent_notNull()72     public void getSeeMoreIntent_notNull() {
73         assertThat(mPanel.getSeeMoreIntent()).isNotNull();
74     }
75 
76     @Test
getViewType_checkType()77     public void getViewType_checkType() {
78         assertThat(mPanel.getViewType()).isEqualTo(PanelContent.VIEW_TYPE_SLIDER);
79     }
80 }
81