1 // Copyright 2016 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // 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
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 
16 // Tests for the BrilloAudioDeviceInfoInternal test.
17 
18 #include <gmock/gmock.h>
19 #include <gtest/gtest.h>
20 
21 #include <hardware/audio.h>
22 
23 #include "brillo_audio_device_info_internal.h"
24 
25 namespace brillo {
26 
TEST(BrilloAudioDeviceInfoInternalTest,OutWiredHeadset)27 TEST(BrilloAudioDeviceInfoInternalTest, OutWiredHeadset) {
28   BAudioDeviceInfoInternal* badi =
29       BAudioDeviceInfoInternal::CreateFromAudioDevicesT(
30           AUDIO_DEVICE_OUT_WIRED_HEADSET);
31   EXPECT_EQ(badi->device_id_, TYPE_WIRED_HEADSET);
32   EXPECT_EQ(badi->GetConfig(), AUDIO_POLICY_FORCE_HEADPHONES);
33 }
34 
TEST(BrilloAudioDeviceInfoInternalTest,OutWiredHeadphone)35 TEST(BrilloAudioDeviceInfoInternalTest, OutWiredHeadphone) {
36   BAudioDeviceInfoInternal* badi =
37       BAudioDeviceInfoInternal::CreateFromAudioDevicesT(
38           AUDIO_DEVICE_OUT_WIRED_HEADPHONE);
39   EXPECT_EQ(badi->device_id_, TYPE_WIRED_HEADPHONES);
40   EXPECT_EQ(badi->GetConfig(), AUDIO_POLICY_FORCE_HEADPHONES);
41 }
42 
TEST(BrilloAudioDeviceInfoInternalTest,InWiredHeadset)43 TEST(BrilloAudioDeviceInfoInternalTest, InWiredHeadset) {
44   BAudioDeviceInfoInternal* badi =
45       BAudioDeviceInfoInternal::CreateFromAudioDevicesT(
46           AUDIO_DEVICE_IN_WIRED_HEADSET);
47   EXPECT_EQ(badi->device_id_, TYPE_WIRED_HEADSET_MIC);
48   EXPECT_EQ(badi->GetConfig(), AUDIO_POLICY_FORCE_HEADPHONES);
49 }
50 
51 }  // namespace brillo
52