1 /*
2  * Copyright (c) 2022-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <chrono>
16 #include <thread>
17 #include "helper/test_player.hpp"
18 #include "testngpp/testngpp.hpp"
19 
20 using namespace OHOS::Media::Test;
21 
22 // @fixture(tags=video_play_slow)
FIXTURE(DataDrivenSingleVideoPlayerTestSlow)23 FIXTURE(DataDrivenSingleVideoPlayerTestSlow)
24 {
25     DATA_PROVIDER(myurls, 1,
26     DATA_GROUP(std::string(RESOURCE_DIR "/MP4/9_AVC_1280x720_59.940fps_AAC_128Kbps_2channels.mp4")),
27     DATA_GROUP(std::string(RESOURCE_DIR "/MP4/11_AVC_640x480_25.000fps.mp4")),
28     DATA_GROUP(std::string(RESOURCE_DIR "/MP4/AVC_1000x526_25FPS.mp4")),
29     DATA_GROUP(std::string(RESOURCE_DIR "/MP4/AVC_1024x526_25FPS.mp4")),
30     DATA_GROUP(std::string(RESOURCE_DIR "/MP4/h264_aac_128x72_30r_voiced.mp4")),
31     DATA_GROUP(std::string(RESOURCE_DIR "/MP4/h264_mute_audio_640x480_30r.mp4")));
32 
33     // @test(data="myurls", tags=video_play_slow)
34     PTEST((std::string url), Test single player play all urls video, and finished automatically)
35     {
36         std::unique_ptr<TestPlayer> player = TestPlayer::Create();
37         ASSERT_EQ(0, player->SetSource(TestSource(url)));
38         ASSERT_EQ(0, player->Prepare());
39         ASSERT_EQ(0, player->Play());
40         while (player->IsPlaying()) {
41             std::this_thread::sleep_for(std::chrono::milliseconds(100));
42         }
43         std::this_thread::sleep_for(std::chrono::seconds(5));
44     }
45 };
46