提交 20b7f5e7 编写于 作者: B bird_j 提交者: Gitee

ActsPlayerFuncTest刷新

Signed-off-by: Nbird_j <jianghongpeng@huawei.com>
上级 4b3fe52e
...@@ -20,75 +20,75 @@ using namespace std; ...@@ -20,75 +20,75 @@ using namespace std;
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Media; using namespace OHOS::Media;
using namespace testing::ext; using namespace testing::ext;
using namespace PlayerNameSpace; using namespace TestPlayerBasic;
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0100 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0100
* @tc.name : 001.prepare-reset,销毁播放器 * @tc.name : 001.prepare-reset
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0100, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0100, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0200 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0200
* @tc.name : 002.prepare-reset,不销毁播放器 * @tc.name : 002.prepare-reset
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0200, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0200, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0300 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0300
* @tc.name : 003.prepare-stop-reset,销毁播放器 * @tc.name : 003.prepare-stop-reset
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0300, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0300, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
...@@ -96,257 +96,257 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0300, Func ...@@ -96,257 +96,257 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0300, Func
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0400 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0400
* @tc.name : 004.prepare-stop-reset,不销毁播放器 * @tc.name : 004.prepare-stop-reset
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0400, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0400, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0600 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0600
* @tc.name : 006.prepare-play-reset,不销毁播放器 * @tc.name : 006.prepare-play-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0600, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0600, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(time, PLAYING_TIME * 1000, 1000); EXPECT_NEAR(time, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0700 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0700
* @tc.name : 007.prepare-seek-play-reset,销毁播放器 * @tc.name : 007.prepare-seek-play-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0700, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0700, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(time, PLAYING_TIME * 1000, 1000); EXPECT_NEAR(time, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0800 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0800
* @tc.name : 008.prepare-seek-play-reset,不销毁播放器 * @tc.name : 008.prepare-seek-play-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0800, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0800, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(time, SEEK_TIME_5_SEC + PLAYING_TIME * 1000, 1000); EXPECT_NEAR(time, SEEK_TIME_5_SEC + PLAYING_TIME * TIME_SEC2MS, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0900 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_0900
* @tc.name : 009.prepare-play-seek-reset,销毁播放器 * @tc.name : 009.prepare-play-seek-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0900, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0900, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1000 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1000
* @tc.name : 010.prepare-play-seek-reset,不销毁播放器 * @tc.name : 010.prepare-play-seek-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1000, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1000, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1100 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1100
* @tc.name : 011.prepare-play-seek-pause-reset,不销毁播放器 * @tc.name : 011.prepare-play-seek-pause-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1100, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1100, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1200 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1200
* @tc.name : 012.prepare-play-seek-pause-reset,销毁播放器 * @tc.name : 012.prepare-play-seek-pause-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
...@@ -354,36 +354,36 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Func ...@@ -354,36 +354,36 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Func
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1300 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1300
* @tc.name : 013.prepare-play-seek-pause-stop-reset,不销毁播放器 * @tc.name : 013.prepare-play-seek-pause-stop-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
...@@ -391,37 +391,37 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Func ...@@ -391,37 +391,37 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Func
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1400 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1400
* @tc.name : 014.prepare-play-seek-pause-stop-reset,销毁播放器 * @tc.name : 014.prepare-play-seek-pause-stop-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
...@@ -430,91 +430,91 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Func ...@@ -430,91 +430,91 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Func
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1500 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1500
* @tc.name : 015.prepare-play-stop-reset,不销毁播放器 * @tc.name : 015.prepare-play-stop-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1500, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1500, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1600 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1600
* @tc.name : 016.prepare-play-stop-reset,销毁播放器 * @tc.name : 016.prepare-play-stop-reset
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1600, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1600, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Release()); EXPECT_EQ(RET_OK, player->Release());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1700 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_1700
* @tc.name : 017.prepare-stop,不销毁播放器 * @tc.name : 017.prepare-stop
* @tc.desc : * @tc.desc :
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1700, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1700, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -524,35 +524,35 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1700, Func ...@@ -524,35 +524,35 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1700, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1800, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1800, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(PLAYING_TIME * 1000 * 2, time, DELTA_TIME); EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS + PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -562,39 +562,39 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1800, Func ...@@ -562,39 +562,39 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1800, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Function | MediumTest | Level0)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
int32_t time; int32_t time;
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_2_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_2_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_2_SEC + PLAYING_TIME * 1000, time, DELTA_TIME); EXPECT_NEAR(SEEK_TIME_2_SEC + PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -604,24 +604,24 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Func ...@@ -604,24 +604,24 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Function | MediumTest | Level1)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->SetLooping(false)); EXPECT_EQ(RET_OK, player->SetLooping(false));
...@@ -629,13 +629,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func ...@@ -629,13 +629,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func
EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE));
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_FALSE(player->IsLooping()); EXPECT_FALSE(player->IsLooping());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(FILE_BEGIN, time); EXPECT_EQ(FILE_BEGIN, time);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -645,18 +645,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func ...@@ -645,18 +645,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Function | MediumTest | Level1)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
...@@ -664,13 +664,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func ...@@ -664,13 +664,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_FALSE(player->IsLooping()); EXPECT_FALSE(player->IsLooping());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(FILE_BEGIN, time); EXPECT_EQ(FILE_BEGIN, time);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -680,42 +680,42 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func ...@@ -680,42 +680,42 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Function | MediumTest | Level1)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time_before; int32_t time_before;
int32_t time_after; int32_t time_after;
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->SetLooping(true)); EXPECT_EQ(RET_OK, player->SetLooping(true));
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE));
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsLooping()); EXPECT_TRUE(player->IsLooping());
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before));
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after));
EXPECT_NEAR(time_after - time_before, PLAYING_TIME * 1000, DELTA_TIME); EXPECT_NEAR(time_after - time_before, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(FILE_BEGIN, time, DELTA_TIME); EXPECT_EQ(FILE_BEGIN, time);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -725,23 +725,23 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Func ...@@ -725,23 +725,23 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Function | MediumTest | Level1)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->SetLooping(false)); EXPECT_EQ(RET_OK, player->SetLooping(false));
...@@ -750,11 +750,11 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func ...@@ -750,11 +750,11 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_FALSE(player->IsLooping()); EXPECT_FALSE(player->IsLooping());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -764,31 +764,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func ...@@ -764,31 +764,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Function | MediumTest | Level1)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime - 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime - 1, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(durationTime, time, DELTA_TIME); EXPECT_NEAR(durationTime, time, DELTA_TIME);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -798,33 +798,33 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Func ...@@ -798,33 +798,33 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
testObj.mutexFlag_ = false; testObj->mutexFlag_ = false;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
testObj.mutexFlag_ = true; testObj->mutexFlag_ = true;
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC + PLAYING_TIME * 1000, time, DELTA_TIME); EXPECT_NEAR(SEEK_TIME_5_SEC + PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -834,31 +834,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Func ...@@ -834,31 +834,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
testObj.mutexFlag_ = false; testObj->mutexFlag_ = false;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
testObj.mutexFlag_ = true; testObj->mutexFlag_ = true;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2625 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2625
...@@ -867,27 +867,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Func ...@@ -867,27 +867,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
testObj.mutexFlag_ = false; testObj->mutexFlag_ = false;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
testObj.mutexFlag_ = true; testObj->mutexFlag_ = true;
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2650 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2650
...@@ -896,27 +896,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Func ...@@ -896,27 +896,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
testObj.mutexFlag_ = false; testObj->mutexFlag_ = false;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2651 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2651
...@@ -925,28 +925,28 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Func ...@@ -925,28 +925,28 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
testObj.mutexFlag_ = false; testObj->mutexFlag_ = false;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2675 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2675
...@@ -955,30 +955,30 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Func ...@@ -955,30 +955,30 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
testObj.mutexFlag_ = false; testObj->mutexFlag_ = false;
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
testObj.mutexFlag_ = true; testObj->mutexFlag_ = true;
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME);
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2700 * @tc.number : SUB_MEDIA_PLAYER_Local_Async_Function_04_2700
...@@ -987,18 +987,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Func ...@@ -987,18 +987,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
...@@ -1007,15 +1007,15 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func ...@@ -1007,15 +1007,15 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -1025,38 +1025,38 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func ...@@ -1025,38 +1025,38 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -1066,20 +1066,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Func ...@@ -1066,20 +1066,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t time_before;
int32_t time_after;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
...@@ -1087,22 +1085,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func ...@@ -1087,22 +1085,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
sleep(PLAYING_TIME);
EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before));
sleep(PLAYING_TIME);
EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
/** /**
...@@ -1112,20 +1106,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func ...@@ -1112,20 +1106,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Function | MediumTest | Level3)
{ {
PlayerSignal testObj; std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(&testObj); std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t time_before; int32_t time_before;
int32_t time_after; int32_t time_after;
int32_t durationTime; int32_t durationTime;
std::string uri = GetUri(); std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(&testObj); std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
...@@ -1135,24 +1129,25 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func ...@@ -1135,24 +1129,25 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(durationTime, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE));
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before));
sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after));
EXPECT_NEAR(time_after - time_before, PLAYING_TIME * 1000, DELTA_TIME); EXPECT_NEAR(time_after - time_before, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
ASSERT_EQ(RET_OK, player->PrepareAsync()); ASSERT_EQ(RET_OK, player->PrepareAsync());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(SEEK_TIME_2_SEC, time); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_2_SEC, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(FILE_BEGIN, time); EXPECT_EQ(FILE_BEGIN, time);
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum); EXPECT_EQ(RET_OK, testCallback->errorNum_);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册