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 @Deprecated(forRemoval = true) 39 @RunWith(RobolectricTestRunner.class) 40 public class VolumePanelTest { 41 42 private VolumePanel mPanel; 43 private Context mContext; 44 45 46 @Before setUp()47 public void setUp() { 48 MockitoAnnotations.initMocks(this); 49 50 mContext = spy(RuntimeEnvironment.application); 51 52 when(mContext.getApplicationContext()).thenReturn(mContext); 53 54 mPanel = VolumePanel.create(mContext); 55 } 56 57 @Test getSlices_checkUri()58 public void getSlices_checkUri() { 59 final List<Uri> uris = mPanel.getSlices(); 60 61 assertThat(uris).containsExactly( 62 CustomSliceRegistry.REMOTE_MEDIA_SLICE_URI, 63 CustomSliceRegistry.VOLUME_CALL_URI, 64 CustomSliceRegistry.VOLUME_MEDIA_URI, 65 CustomSliceRegistry.MEDIA_OUTPUT_INDICATOR_SLICE_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