VideoProfileTest.java revision 608ab6fb9b9cf2e027d5e3e3667e3ba4bdc09a53
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
17package com.android.server.telecom.tests;
18
19import android.telecom.VideoProfile;
20import android.test.AndroidTestCase;
21import android.test.suitebuilder.annotation.SmallTest;
22
23/**
24 * Unit tests for the {@link android.telecom.VideoProfile} class.
25 */
26public class VideoProfileTest extends AndroidTestCase {
27    @SmallTest
28    public void testToString() {
29        assertEquals("Audio Only", VideoProfile.videoStateToString(VideoProfile.STATE_AUDIO_ONLY));
30        assertEquals("Audio Tx", VideoProfile.videoStateToString(VideoProfile.STATE_TX_ENABLED));
31        assertEquals("Audio Rx", VideoProfile.videoStateToString(VideoProfile.STATE_RX_ENABLED));
32        assertEquals("Audio Tx Rx", VideoProfile.videoStateToString(
33                VideoProfile.STATE_BIDIRECTIONAL));
34
35        assertEquals("Audio Pause", VideoProfile.videoStateToString(VideoProfile.STATE_PAUSED));
36        assertEquals("Audio Tx Pause", VideoProfile.videoStateToString(
37                VideoProfile.STATE_TX_ENABLED | VideoProfile.STATE_PAUSED));
38        assertEquals("Audio Rx Pause", VideoProfile.videoStateToString(
39                VideoProfile.STATE_RX_ENABLED | VideoProfile.STATE_PAUSED));
40        assertEquals("Audio Tx Rx Pause", VideoProfile.videoStateToString(
41                VideoProfile.STATE_BIDIRECTIONAL | VideoProfile.STATE_PAUSED));
42    }
43
44    @SmallTest
45    public void testIsAudioOnly() {
46        assertFalse(VideoProfile.isAudioOnly(VideoProfile.STATE_RX_ENABLED));
47        assertFalse(VideoProfile.isAudioOnly(VideoProfile.STATE_TX_ENABLED));
48        assertFalse(VideoProfile.isAudioOnly(VideoProfile.STATE_BIDIRECTIONAL));
49
50        assertTrue(VideoProfile.isAudioOnly(VideoProfile.STATE_PAUSED));
51        assertTrue(VideoProfile.isAudioOnly(VideoProfile.STATE_AUDIO_ONLY));
52    }
53}
54