fixup! mm_sound_proxy: add bt-a2dp device to query list properly only if mask satisfied
[platform/core/multimedia/libmm-sound.git] / unittest / libmm_sound_unittest.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
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
18 #include "libmm_sound_unittest.h"
19 #include "mm_sound.h"
20
21 using ::testing::InitGoogleTest;
22 using ::testing::Test;
23 using ::testing::TestCase;
24
25 using namespace std;
26
27 // MMSoundVolumeTest TestSuite
28 class MMSoundVolumeTest : public ::testing::Test
29 {
30 protected:
31         void SetUp() {
32                 cout << "SetUp()" << endl;
33         }
34
35         void TearDown() {
36                 cout << "TearDown()" << endl;
37         }
38 };
39
40 TEST_F(MMSoundVolumeTest, volume_get_value_p)
41 {
42         int ret = MM_ERROR_NONE;
43         unsigned int vol = 0;
44
45         ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &vol);
46         EXPECT_EQ(ret, MM_ERROR_NONE);
47         cout << "volume : " << vol << endl;
48 }
49
50 TEST_F(MMSoundVolumeTest, volume_get_value_n)
51 {
52         int ret = MM_ERROR_NONE;
53
54         ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, NULL);
55         EXPECT_EQ(ret, MM_ERROR_INVALID_ARGUMENT);
56 }
57
58 // MMSoundDeviceTest TestSuite
59 class MMSoundDeviceTest : public ::testing::Test
60 {
61 protected:
62         void SetUp() {
63                 cout << "SetUp()" << endl;
64         }
65
66         void TearDown() {
67                 cout << "TearDown()" << endl;
68         }
69 };
70
71 TEST_F(MMSoundDeviceTest, device_get_list_p)
72 {
73         int ret = MM_ERROR_NONE;
74         MMSoundDeviceList_t device_list;
75
76         ret = mm_sound_get_device_list(MM_SOUND_DEVICE_ALL_FLAG, &device_list);
77
78         EXPECT_EQ(ret, MM_ERROR_NONE);
79
80         mm_sound_free_device_list(device_list);
81 }
82
83 TEST_F(MMSoundDeviceTest, device_get_list_n)
84 {
85         int ret = MM_ERROR_NONE;
86
87         ret = mm_sound_get_device_list(MM_SOUND_DEVICE_ALL_FLAG, NULL);
88
89         EXPECT_EQ(ret, MM_ERROR_INVALID_ARGUMENT);
90
91 }
92
93 // MAIN
94 int main(int argc, char **argv)
95 {
96         InitGoogleTest(&argc, argv);
97
98         return RUN_ALL_TESTS();
99 }
100