提交 6d31676c 编写于 作者: B bird_j 提交者: Gitee

头文件刷新

Signed-off-by: Nbird_j <jianghongpeng@huawei.com>
上级 595aa672
......@@ -13,28 +13,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "media_log.h"
#include "securec.h"
#define MEDIA_DEBUG_LOG(fmt, ...) \
#define LOGMAXSIZE 200
#define MEDIA_INFO_LOG(fmt, ...) \
do { \
printf(fmt, ##__VA_ARGS__); \
printf("\n"); \
__MEDIA_LOG(::OHOS::HiviewDFX::HiLog::Debug, fmt, ##__VA_ARGS__); \
} while (0) \
char ch[LOGMAXSIZE]; \
(void)sprintf_s(ch, LOGMAXSIZE, fmt, ##__VA_ARGS__); \
(void)printf("%s", ch); \
(void)printf("\n"); \
__MEDIA_LOG(::OHOS::HiviewDFX::HiLog::Info, "%{public}s", ch); \
} while (0)
#define MEDIA_INFO_LOG(fmt, ...) \
#define MEDIA_DEBUG_LOG(fmt, ...) \
do { \
printf(fmt, ##__VA_ARGS__); \
printf("\n"); \
__MEDIA_LOG(::OHOS::HiviewDFX::HiLog::Info, fmt, ##__VA_ARGS__); \
} while (0) \
char ch[LOGMAXSIZE]; \
(void)sprintf_s(ch, LOGMAXSIZE, fmt, ##__VA_ARGS__); \
__MEDIA_LOG(::OHOS::HiviewDFX::HiLog::Debug, "%{public}s", ch); \
} while (0)
#define MEDIA_ERROR_LOG(fmt, ...) \
do { \
printf(fmt, ##__VA_ARGS__); \
printf("\n"); \
__MEDIA_LOG(::OHOS::HiviewDFX::HiLog::Error, fmt, ##__VA_ARGS__); \
} while (0) \
char ch[LOGMAXSIZE]; \
(void)sprintf_s(ch, LOGMAXSIZE, fmt, ##__VA_ARGS__); \
(void)printf("%s", ch); \
(void)printf("\n"); \
__MEDIA_LOG(::OHOS::HiviewDFX::HiLog::Error, "%{public}s", ch); \
} while (0)
namespace {
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN, "MediaTest"};
......
......@@ -21,25 +21,27 @@ namespace OHOS {
namespace Media {
class ActsPlayerAPITest : public testing::Test {
public:
// SetUpTestCase: before all testcasee
// SetUpTestCase: before all testcases
static void SetUpTestCase(void)
{
MEDIA_INFO_LOG("ActsPlayerAPITest::SetUpTestCase");
MEDIA_DEBUG_LOG("ActsPlayerAPITest::SetUpTestCase");
};
// TearDownTestCase: after all testcase
// TearDownTestCase: after all testcases
static void TearDownTestCase(void)
{
MEDIA_INFO_LOG("ActsPlayerAPITest::TearDownTestCase");
MEDIA_DEBUG_LOG("ActsPlayerAPITest::TearDownTestCase");
};
// SetUp
void SetUp(void)
{
MEDIA_INFO_LOG("ActsPlayerAPITest::SetUp");
const ::testing::TestInfo * const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
MEDIA_DEBUG_LOG("ActsPlayerAPITest::SetUp:%s", testInfo->name());
};
// TearDown
void TearDown(void)
{
MEDIA_INFO_LOG("ActsPlayerAPITest::TearDown");
const ::testing::TestInfo * const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
MEDIA_DEBUG_LOG("ActsPlayerAPITest::TearDown:%s", testInfo->name());
};
void LocalPlayFunc(const std::string uri, bool isAsync, WindowConfig config = g_config);
};
......
......@@ -21,25 +21,28 @@ namespace OHOS {
namespace Media {
class ActsPlayerFuncTest : public testing::Test {
public:
// SetUpTestCase: before all testcasee
// SetUpTestCase: before all testcases
static void SetUpTestCase(void)
{
MEDIA_INFO_LOG("ActsPlayerFuncTest::SetUpTestCase");
MEDIA_DEBUG_LOG("ActsPlayerFuncTest::SetUpTestCase");
TestPlayerBasic::TestParamsConfig::GetInstance().InitPlayProtocol();
};
// TearDownTestCase: after all testcase
// TearDownTestCase: after all testcases
static void TearDownTestCase(void)
{
MEDIA_INFO_LOG("ActsPlayerFuncTest::TearDownTestCase");
MEDIA_DEBUG_LOG("ActsPlayerFuncTest::TearDownTestCase");
};
// SetUp
void SetUp(void)
{
MEDIA_INFO_LOG("ActsPlayerFuncTest::SetUp");
const ::testing::TestInfo * const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
MEDIA_DEBUG_LOG("ActsPlayerFuncTest::SetUp:%s", testInfo->name());
};
// TearDown
void TearDown(void)
{
MEDIA_INFO_LOG("ActsPlayerFuncTest::TearDown");
const ::testing::TestInfo * const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
MEDIA_DEBUG_LOG("ActsPlayerFuncTest::TearDown:%s", testInfo->name());
};
static void LocalPlayFunc(const std::string uri, bool isAsync, WindowConfig config = g_sub_config);
static void *LocalMulitPlayFunc(void *threadarg);
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PLAYER_COMMON_TEST_H
#define PLAYER_COMMON_TEST_H
#include "gtest/gtest.h"
#include "mediatest_log.h"
#include "player.h"
namespace {
static const int32_t PLAYING_TIME = 3;
static const int32_t SEEK_TIME_5_SEC = 5000;
static const int32_t SEEK_TIME_2_SEC = 2000;
static const int32_t DELTA_TIME = 1000;
static const int32_t CLOSEST_DELTA_TIME = 300;
static const int32_t WAITSECOND = 2;
static const int32_t RET_OK = 0;
static const int32_t FILE_BEGIN = 0;
static const int32_t PARA_MAX_LEN = 256;
static const int32_t TIME_SEC2MS = 1000;
static const int32_t WAIT_TIME = 1000;
static const OHOS::Media::PlayerSeekMode SEEK_MODE = OHOS::Media::PlayerSeekMode::SEEK_CLOSEST;
}
namespace TestPlayerBasic {
class TestParamsConfig {
public:
static TestParamsConfig& GetInstance()
{
static TestParamsConfig config;
return config;
}
std::string GetMountPath() const
{
return mountPath_;
}
void SetMountPath(std::string mountPath)
{
mountPath_ = mountPath;
}
bool CompareTime(int32_t expectTime, int32_t realTme, OHOS::Media::PlayerSeekMode seekMode);
std::string GetUri();
void InitPlayProtocol();
private:
TestParamsConfig();
~TestParamsConfig();
std::string mountPath_ = "";
};
}
#endif
\ No newline at end of file
......@@ -13,9 +13,11 @@
* limitations under the License.
*/
#ifndef PLAYER_TEST_H
#define PLAYER_TEST_H
#include "securec.h"
#include "common.h"
#include "mediatest_log.h"
#include "TestParamsConfig.h"
#include "window_manager.h"
#include "surface_type.h"
#include "display_type.h"
......@@ -65,13 +67,13 @@ public:
};
class TestPlayer {
public:
std::shared_ptr<Player> player;
std::unique_ptr<Window> mwindow;
std::unique_ptr<SubWindow> window;
explicit TestPlayer(PlayerSignal *test);
~TestPlayer();
std::shared_ptr<Player> player_;
sptr<Window> window_;
explicit TestPlayer(std::shared_ptr<PlayerSignal> test);
virtual ~TestPlayer();
bool CreatePlayer();
int32_t SetSource(const std::string &uri);
int32_t SetDataSrc(const std::string &uri, bool seekable);
int32_t Play();
int32_t Prepare();
int32_t PrepareAsync();
......@@ -92,16 +94,14 @@ public:
int32_t SetLooping(bool loop);
int32_t SetPlayerCallback(const std::shared_ptr<PlayerCallback> &callback);
private:
void InitSubWindow(WindowConfig sub_config);
PlayerSignal *test_;
std::shared_ptr<PlayerSignal> test_;
};
class TestPlayerCallback : public PlayerCallback {
public:
int errorNum = 0;
int errorNum_ = 0;
PlayerStates state_ = PLAYER_STATE_ERROR;
explicit TestPlayerCallback(PlayerSignal *test);
~TestPlayerCallback();
explicit TestPlayerCallback(std::shared_ptr<PlayerSignal> test);
virtual ~TestPlayerCallback();
void OnError(PlayerErrorType errorType, int32_t errorCode);
int WaitForSeekDone(int32_t currentPositon);
void OnInfo(PlayerOnInfoType type, int32_t extra, const Format &infoBody = {});
......@@ -109,11 +109,11 @@ public:
private:
PlayerErrorType errorType_ = PLAYER_ERROR_UNKNOWN;
int32_t errorCode_ = -1;
bool seekDoneFlag = false;
bool seekDoneFlag_ = false;
int32_t postion_ = 0;
void PrintState(PlayerStates state);
PlayerSignal *test_;
std::shared_ptr<PlayerSignal> test_;
};
}
}
#endif
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册