• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
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 #ifndef SOUNDPOOL_UNIT_TEST_H
16 #define SOUNDPOOL_UNIT_TEST_H
17 
18 #include "gtest/gtest.h"
19 #include "soundpool_mock.h"
20 
21 namespace OHOS {
22 namespace Media {
23 class SoundPoolUnitTest : public testing::Test {
24 public:
25     static void SetUpTestCase(void);
26     static void TearDownTestCase(void);
27     void SetUp(void);
28     void TearDown(void);
29 
30 protected:
31     static const int32_t SOUND_NUM = 4;
32     static const int32_t waitTime1 = 1;
33     static const int32_t waitTime2 = 2;
34     static const int32_t waitTime3 = 3;
35     static const int32_t waitTime10 = 10;
36     static const int32_t waitTime30 = 30;
37     int32_t loadNum_ = 0;
38     int32_t playNum_ = 0;
39     int32_t soundIDs_[SOUND_NUM];
40     int32_t streamIDs_[SOUND_NUM];
41     int32_t fds_[SOUND_NUM];
42     std::shared_ptr<SoundPoolMock> soundPool_ = nullptr;
43     void create(int maxStreams);
44     void loadUrl(std::string fileName, int32_t loadNum);
45     void loadFd(std::string fileName, int32_t loadNum);
46     void functionTest043(std::shared_ptr<SoundPoolMock> soundPool1, std::shared_ptr<SoundPoolMock> soundPool2,
47         std::shared_ptr<SoundPoolCallbackTest> cb1, std::shared_ptr<SoundPoolCallbackTest> cb2);
48 };
49 } // namespace Media
50 } // namespace OHOS
51 #endif