• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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.server.telecom.tests;
18 
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertFalse;
21 import static org.junit.Assert.assertTrue;
22 
23 import android.telecom.VideoProfile;
24 import android.test.suitebuilder.annotation.SmallTest;
25 
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
28 import org.junit.runners.JUnit4;
29 
30 /**
31  * Unit tests for the {@link android.telecom.VideoProfile} class.
32  */
33 @RunWith(JUnit4.class)
34 public class VideoProfileTest extends TelecomTestCase {
35     @SmallTest
36     @Test
testToString()37     public void testToString() {
38         assertEquals("Audio Only", VideoProfile.videoStateToString(VideoProfile.STATE_AUDIO_ONLY));
39         assertEquals("Audio Tx", VideoProfile.videoStateToString(VideoProfile.STATE_TX_ENABLED));
40         assertEquals("Audio Rx", VideoProfile.videoStateToString(VideoProfile.STATE_RX_ENABLED));
41         assertEquals("Audio Tx Rx", VideoProfile.videoStateToString(
42                 VideoProfile.STATE_BIDIRECTIONAL));
43 
44         assertEquals("Audio Pause", VideoProfile.videoStateToString(VideoProfile.STATE_PAUSED));
45         assertEquals("Audio Tx Pause", VideoProfile.videoStateToString(
46                 VideoProfile.STATE_TX_ENABLED | VideoProfile.STATE_PAUSED));
47         assertEquals("Audio Rx Pause", VideoProfile.videoStateToString(
48                 VideoProfile.STATE_RX_ENABLED | VideoProfile.STATE_PAUSED));
49         assertEquals("Audio Tx Rx Pause", VideoProfile.videoStateToString(
50                 VideoProfile.STATE_BIDIRECTIONAL | VideoProfile.STATE_PAUSED));
51     }
52 
53     @SmallTest
54     @Test
testIsAudioOnly()55     public void testIsAudioOnly() {
56         assertFalse(VideoProfile.isAudioOnly(VideoProfile.STATE_RX_ENABLED));
57         assertFalse(VideoProfile.isAudioOnly(VideoProfile.STATE_TX_ENABLED));
58         assertFalse(VideoProfile.isAudioOnly(VideoProfile.STATE_BIDIRECTIONAL));
59 
60         assertTrue(VideoProfile.isAudioOnly(VideoProfile.STATE_PAUSED));
61         assertTrue(VideoProfile.isAudioOnly(VideoProfile.STATE_AUDIO_ONLY));
62     }
63 }
64