• 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 CACHEBUFFER_UNIT_TEST_H
16 #define CACHEBUFFER_UNIT_TEST_H
17 
18 #include "gtest/gtest.h"
19 #include "cachebuffer_mock.h"
20 #include "soundpool.h"
21 #include "soundpool_manager.h"
22 #include "sound_parser.h"
23 #include "thread_pool.h"
24 #include "avcodec_audio_decoder.h"
25 #include "avcodec_errors.h"
26 #include "avdemuxer.h"
27 #include "avsource.h"
28 
29 namespace OHOS {
30 namespace Media {
31 using namespace AudioStandard;
32 using namespace MediaAVCodec;
33 class CacheBufferUnitTest : public testing::Test {
34 public:
35     static void SetUpTestCase(void);
36     static void TearDownTestCase(void);
37     void SetUp(void);
38     void TearDown(void);
39 
40 protected:
41     static const int32_t waitTime1 = 1;
42     static const int32_t waitTime2 = 2;
43     static const int32_t waitTime3 = 3;
44     static const int32_t waitTime10 = 10;
45     static const int32_t waitTime20 = 20;
46     static const int32_t waitTime30 = 30;
47     int32_t loadNum_ = 0;
48     void CreateCacheBuffer(const Format &trackFormat, const int32_t &soundID, const int32_t &streamID);
49     int32_t GetFdByFileName(std::string fileName);
50     std::shared_ptr<CacheBufferMock> cacheBuffer_ = nullptr;
51     std::shared_ptr<ThreadPool> cacheBufferStopThreadPool_;
52     std::atomic<bool> isCacheBufferStopThreadPoolStarted_ = false;
53 };
54 } // namespace Media
55 } // namespace OHOS
56 #endif