1 /*
2 * Copyright (c) 2025 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
16 #include "camera_moving_photo_moduletest.h"
17
18 #include "accesstoken_kit.h"
19 #include "camera_error_code.h"
20 #include "camera_log.h"
21 #include "camera_util.h"
22 #include "camera_photo_proxy.h"
23 #include "hap_token_info.h"
24 #include "ipc_skeleton.h"
25 #include "media_asset_capi.h"
26 #include "media_asset_helper.h"
27 #include "media_access_helper_capi.h"
28 #include "media_asset_change_request_capi.h"
29 #include "media_photo_asset_proxy.h"
30 #include "native_image.h"
31 #include "nativetoken_kit.h"
32 #include "securec.h"
33 #include "system_ability_definition.h"
34 #include "test_common.h"
35 #include "test_token.h"
36 #include "token_setproc.h"
37 #include "os_account_manager.h"
38 #include "video_key_info.h"
39 #include "userfile_manager_types.h"
40
41 using namespace testing::ext;
42
43 namespace OHOS {
44 namespace CameraStandard {
45 static std::mutex g_mutex;
46 const char* DEFAULT_SURFACEID = "photoOutput";
47
48 OH_MediaAsset *CameraMovingPhotoModuleTest::mediaAsset_ = nullptr;
49 OH_MovingPhoto *CameraMovingPhotoModuleTest::movingPhoto_ = nullptr;
50 OH_MediaAssetManager *CameraMovingPhotoModuleTest::mediaAssetManager_ = nullptr;
51
PhotoListenerTest(PhotoOutput * photoOutput,sptr<Surface> surface)52 PhotoListenerTest::PhotoListenerTest(PhotoOutput* photoOutput, sptr<Surface> surface)
53 : photoOutput_(photoOutput), photoSurface_(surface)
54 {
55 MEDIA_DEBUG_LOG("movingp photo module test photoListenerTest structure");
56 }
57
~PhotoListenerTest()58 PhotoListenerTest::~PhotoListenerTest()
59 {
60 photoSurface_ = nullptr;
61 }
62
OnBufferAvailable()63 void PhotoListenerTest::OnBufferAvailable()
64 {
65 MEDIA_INFO_LOG("PhotoListenerTest::OnBufferAvailable");
66 std::lock_guard<std::mutex> lock(g_mutex);
67 CAMERA_SYNC_TRACE;
68 MEDIA_INFO_LOG("PhotoListenerTest::OnBufferAvailable is called");
69 CHECK_RETURN_ELOG(photoSurface_ == nullptr, "photoSurface_ is null");
70
71 int64_t timestamp;
72 OHOS::Rect damage;
73 sptr<SurfaceBuffer> surfaceBuffer = nullptr;
74 int32_t fence = -1;
75 SurfaceError surfaceRet = photoSurface_->AcquireBuffer(surfaceBuffer, fence, timestamp, damage);
76 CHECK_RETURN_ELOG(surfaceRet != SURFACE_ERROR_OK, "Failed to acquire surface buffer");
77
78 CameraBufferExtraData extraData = GetCameraBufferExtraData(surfaceBuffer);
79
80 if ((callbackFlag_ & CAPTURE_PHOTO_ASSET) != 0) {
81 MEDIA_DEBUG_LOG("PhotoListenerTest on capture photo asset callback");
82 sptr<SurfaceBuffer> newSurfaceBuffer = SurfaceBuffer::Create();
83 DeepCopyBuffer(newSurfaceBuffer, surfaceBuffer);
84 photoSurface_->ReleaseBuffer(surfaceBuffer, -1);
85 CHECK_RETURN_ELOG(newSurfaceBuffer == nullptr, "deep copy buffer failed");
86 MEDIA_DEBUG_LOG("PhotoListenerTest on capture photo asset callback end");
87 } else if (extraData.isDegradedImage == 0 && (callbackFlag_ & CAPTURE_PHOTO) != 0) {
88 MEDIA_DEBUG_LOG("PhotoListenerTest on capture photo callback");
89 photoSurface_->ReleaseBuffer(surfaceBuffer, -1);
90 } else {
91 MEDIA_INFO_LOG("PhotoListenerTest on error callback");
92 photoSurface_->ReleaseBuffer(surfaceBuffer, -1);
93 }
94 }
95
SetCallbackFlag(uint8_t callbackFlag)96 void PhotoListenerTest::SetCallbackFlag(uint8_t callbackFlag)
97 {
98 callbackFlag_ = callbackFlag;
99 }
100
SetPhotoAssetAvailableCallback(PhotoOutputTest_PhotoAssetAvailable callback)101 void PhotoListenerTest::SetPhotoAssetAvailableCallback(PhotoOutputTest_PhotoAssetAvailable callback)
102 {
103 std::lock_guard<std::mutex> lock(g_mutex);
104 MEDIA_INFO_LOG("PhotoListenerTest::SetPhotoAssetAvailableCallback is called");
105 if (callback != nullptr) {
106 photoAssetCallback_ = callback;
107 }
108 }
109
UnregisterPhotoAssetAvailableCallback(PhotoOutputTest_PhotoAssetAvailable callback)110 void PhotoListenerTest::UnregisterPhotoAssetAvailableCallback(PhotoOutputTest_PhotoAssetAvailable callback)
111 {
112 std::lock_guard<std::mutex> lock(g_mutex);
113 MEDIA_INFO_LOG("PhotoListenerTest::UnregisterPhotoAssetAvailableCallback is called");
114 if (photoAssetCallback_ != nullptr && callback != nullptr) {
115 photoAssetCallback_ = nullptr;
116 }
117 }
118
ExecutePhotoAsset(sptr<SurfaceBuffer> surfaceBuffer,CameraBufferExtraData extraData,bool isHighQuality,int64_t timestamp)119 void PhotoListenerTest::ExecutePhotoAsset(sptr<SurfaceBuffer> surfaceBuffer, CameraBufferExtraData extraData,
120 bool isHighQuality, int64_t timestamp)
121 {
122 CAMERA_SYNC_TRACE;
123 BufferHandle* bufferHandle = surfaceBuffer->GetBufferHandle();
124 CHECK_RETURN_ELOG(bufferHandle == nullptr, "invalid bufferHandle");
125
126 surfaceBuffer->Map();
127 std::string uri = "";
128 int32_t cameraShotType = 0;
129 std::string burstKey = "";
130 CreateMediaLibrary(surfaceBuffer, bufferHandle, extraData, isHighQuality,
131 uri, cameraShotType, burstKey, timestamp);
132 CHECK_RETURN_ELOG(uri.empty(), "uri is empty");
133
134 auto mediaAssetHelper = Media::MediaAssetHelperFactory::CreateMediaAssetHelper();
135 CHECK_RETURN_ELOG(mediaAssetHelper == nullptr, "create media asset helper failed");
136
137 auto mediaAsset = mediaAssetHelper->GetMediaAsset(uri, cameraShotType, burstKey);
138 CHECK_RETURN_ELOG(mediaAsset == nullptr, "Create photo asset failed");
139
140 if (photoAssetCallback_ != nullptr && photoOutput_ != nullptr) {
141 photoAssetCallback_(photoOutput_, mediaAsset);
142 }
143 }
144
DeepCopyBuffer(sptr<SurfaceBuffer> newSurfaceBuffer,sptr<SurfaceBuffer> surfaceBuffer)145 void PhotoListenerTest::DeepCopyBuffer(sptr<SurfaceBuffer> newSurfaceBuffer, sptr<SurfaceBuffer> surfaceBuffer)
146 {
147 CAMERA_SYNC_TRACE;
148 BufferRequestConfig requestConfig = {
149 .width = surfaceBuffer->GetWidth(),
150 .height = surfaceBuffer->GetHeight(),
151 .strideAlignment = 0x8, // default stride is 8 Bytes.
152 .format = surfaceBuffer->GetFormat(),
153 .usage = surfaceBuffer->GetUsage(),
154 .timeout = 0,
155 .colorGamut = surfaceBuffer->GetSurfaceBufferColorGamut(),
156 .transform = surfaceBuffer->GetSurfaceBufferTransform(),
157 };
158 auto allocErrorCode = newSurfaceBuffer->Alloc(requestConfig);
159 MEDIA_INFO_LOG("SurfaceBuffer alloc ret: %d", allocErrorCode);
160 if (memcpy_s(newSurfaceBuffer->GetVirAddr(), newSurfaceBuffer->GetSize(),
161 surfaceBuffer->GetVirAddr(), surfaceBuffer->GetSize()) != EOK) {
162 MEDIA_ERR_LOG("PhotoListener memcpy_s failed");
163 }
164 }
165
CreateMediaLibrary(sptr<SurfaceBuffer> surfaceBuffer,BufferHandle * bufferHandle,CameraBufferExtraData extraData,bool isHighQuality,std::string & uri,int32_t & cameraShotType,std::string & burstKey,int64_t timestamp)166 void PhotoListenerTest::CreateMediaLibrary(sptr<SurfaceBuffer> surfaceBuffer, BufferHandle *bufferHandle,
167 CameraBufferExtraData extraData, bool isHighQuality, std::string &uri,
168 int32_t &cameraShotType, std::string &burstKey, int64_t timestamp)
169 {
170 CAMERA_SYNC_TRACE;
171 CHECK_RETURN_ELOG(bufferHandle == nullptr, "bufferHandle is nullptr");
172
173 int32_t format = bufferHandle->format;
174 sptr<CameraPhotoProxy> photoProxy;
175 std::string imageIdStr = std::to_string(extraData.imageId);
176 photoProxy = new(std::nothrow) CameraPhotoProxy(bufferHandle, format, extraData.photoWidth, extraData.photoHeight,
177 isHighQuality, extraData.captureId);
178 CHECK_RETURN_ELOG(photoProxy == nullptr, "Failed to new photoProxy");
179
180 photoProxy->SetDeferredAttrs(imageIdStr, extraData.deferredProcessingType, extraData.size,
181 extraData.deferredImageFormat);
182 if (photoOutput_ && photoOutput_->GetSession()) {
183 auto settings = photoOutput_->GetDefaultCaptureSetting();
184 if (settings) {
185 auto location = std::make_shared<Location>();
186 settings->GetLocation(location);
187 photoProxy->SetLocation(location->latitude, location->longitude);
188 }
189 photoOutput_->CreateMediaLibrary(photoProxy, uri, cameraShotType, burstKey, timestamp);
190 }
191 }
192
GetCameraBufferExtraData(const sptr<SurfaceBuffer> & surfaceBuffer)193 CameraBufferExtraData PhotoListenerTest::GetCameraBufferExtraData(const sptr<SurfaceBuffer> &surfaceBuffer)
194 {
195 CameraBufferExtraData extraData;
196 surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::captureId, extraData.captureId);
197 surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::imageId, extraData.imageId);
198 surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::deferredProcessingType, extraData.deferredProcessingType);
199 MEDIA_INFO_LOG("imageId:%{public}" PRId64
200 ", deferredProcessingType:%{public}d",
201 extraData.imageId,
202 extraData.deferredProcessingType);
203
204 surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::dataWidth, extraData.photoWidth);
205 surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::dataHeight, extraData.photoHeight);
206 uint64_t size = static_cast<uint64_t>(surfaceBuffer->GetSize());
207
208 auto res = surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::dataSize, extraData.extraDataSize);
209 if (res != 0) {
210 MEDIA_INFO_LOG("ExtraGet dataSize error %{public}d", res);
211 } else if (extraData.extraDataSize <= 0) {
212 MEDIA_INFO_LOG("ExtraGet dataSize OK, but size <= 0");
213 } else if (static_cast<uint64_t>(extraData.extraDataSize) > size) {
214 MEDIA_INFO_LOG("ExtraGet dataSize OK, but dataSize %{public}d is bigger "
215 "than bufferSize %{public}" PRIu64,
216 extraData.extraDataSize,
217 size);
218 } else {
219 MEDIA_INFO_LOG("ExtraGet dataSize %{public}d", extraData.extraDataSize);
220 size = static_cast<uint64_t>(extraData.extraDataSize);
221 }
222 extraData.size = size;
223
224 res = surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::deferredImageFormat, extraData.deferredImageFormat);
225 MEDIA_INFO_LOG("deferredImageFormat:%{public}d, width:%{public}d, "
226 "height:%{public}d, size:%{public}" PRId64,
227 extraData.deferredImageFormat,
228 extraData.photoWidth,
229 extraData.photoHeight,
230 size);
231
232 surfaceBuffer->GetExtraData()->ExtraGet(OHOS::Camera::isDegradedImage, extraData.isDegradedImage);
233 MEDIA_INFO_LOG("isDegradedImage:%{public}d", extraData.isDegradedImage);
234
235 return extraData;
236 }
237
SetUpTestCase(void)238 void CameraMovingPhotoModuleTest::SetUpTestCase(void)
239 {
240 MEDIA_DEBUG_LOG("CameraMovingPhotoModuleTest::SetUpTestCase started!");
241 ASSERT_TRUE(TestToken().GetAllCameraPermission());
242 }
243
TearDownTestCase(void)244 void CameraMovingPhotoModuleTest::TearDownTestCase(void)
245 {
246 MEDIA_DEBUG_LOG("CameraMovingPhotoModuleTest::TearDownTestCase started!");
247 }
248
SetUp()249 void CameraMovingPhotoModuleTest::SetUp()
250 {
251 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::SetUp start!");
252
253 manager_ = CameraManager::GetInstance();
254 ASSERT_NE(manager_, nullptr);
255 cameras_ = manager_->GetSupportedCameras();
256 ASSERT_FALSE(cameras_.empty());
257 session_ = manager_->CreateCaptureSession(SceneMode::CAPTURE);
258 ASSERT_NE(session_, nullptr);
259 input_ = manager_->CreateCameraInput(cameras_[0]);
260 ASSERT_NE(input_, nullptr);
261 EXPECT_EQ(input_->Open(), SUCCESS);
262
263 UpdateCameraOutputCapability();
264 EXPECT_EQ(CreatePreviewOutput(previewProfile_[0], previewOutput_), SUCCESS);
265 EXPECT_EQ(CreatePhotoOutputWithoutSurface(photoProfile_[0], photoOutput_), SUCCESS);
266
267 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::SetUp end!");
268 }
269
TearDown()270 void CameraMovingPhotoModuleTest::TearDown()
271 {
272 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::TearDown start!");
273
274 cameras_.clear();
275 photoProfile_.clear();
276 previewProfile_.clear();
277
278 photoOutput_->Release();
279 previewOutput_->Release();
280
281 manager_ = nullptr;
282 input_->Release();
283 session_->Release();
284
285 if (photoSurface_) {
286 photoSurface_ = nullptr;
287 }
288 if (photoListener_) {
289 photoListener_ =nullptr;
290 }
291 ReleaseMediaAsset();
292
293 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::TearDown end!");
294 }
295
UpdateCameraOutputCapability(int32_t modeName)296 void CameraMovingPhotoModuleTest::UpdateCameraOutputCapability(int32_t modeName)
297 {
298 if (!manager_ || cameras_.empty()) {
299 return;
300 }
301 auto outputCapability = manager_->GetSupportedOutputCapability(cameras_[0], modeName);
302 ASSERT_NE(outputCapability, nullptr);
303
304 previewProfile_ = outputCapability->GetPreviewProfiles();
305 ASSERT_FALSE(previewProfile_.empty());
306
307 photoProfile_ = outputCapability->GetPhotoProfiles();
308 ASSERT_FALSE(photoProfile_.empty());
309 }
310
RegisterPhotoAssetAvailableCallback(PhotoOutputTest_PhotoAssetAvailable callback)311 int32_t CameraMovingPhotoModuleTest::RegisterPhotoAssetAvailableCallback(
312 PhotoOutputTest_PhotoAssetAvailable callback)
313 {
314 CHECK_RETURN_RET_ELOG(photoSurface_ == nullptr, INVALID_ARGUMENT,
315 "Photo surface is invalid");
316 if (photoListener_ == nullptr) {
317 photoListener_ = new (std::nothrow) PhotoListenerTest(photoOutput_, photoSurface_);
318 CHECK_RETURN_RET_ELOG(photoListener_ == nullptr, SERVICE_FATL_ERROR,
319 "Create photo listener failed");
320
321 SurfaceError ret = photoSurface_->RegisterConsumerListener((sptr<IBufferConsumerListener>&)photoListener_);
322 CHECK_RETURN_RET_ELOG(ret != SURFACE_ERROR_OK, SERVICE_FATL_ERROR,
323 "Register surface consumer listener failed");
324 }
325 photoListener_->SetPhotoAssetAvailableCallback(callback);
326 callbackFlag_ |= CAPTURE_PHOTO_ASSET;
327 photoListener_->SetCallbackFlag(callbackFlag_);
328 photoOutput_->SetCallbackFlag(callbackFlag_);
329 return SUCCESS;
330 }
331
UnregisterPhotoAssetAvailableCallback(PhotoOutputTest_PhotoAssetAvailable callback)332 int32_t CameraMovingPhotoModuleTest::UnregisterPhotoAssetAvailableCallback(
333 PhotoOutputTest_PhotoAssetAvailable callback)
334 {
335 if (callback != nullptr) {
336 if (photoListener_ != nullptr) {
337 callbackFlag_ &= ~CAPTURE_PHOTO_ASSET;
338 photoListener_->SetCallbackFlag(callbackFlag_);
339 photoListener_->UnregisterPhotoAssetAvailableCallback(callback);
340 }
341 }
342 return SUCCESS;
343 }
344
CreatePreviewOutput(Profile & profile,sptr<PreviewOutput> & previewOutput)345 int32_t CameraMovingPhotoModuleTest::CreatePreviewOutput(Profile &profile, sptr<PreviewOutput> &previewOutput)
346 {
347 sptr<Surface> surface = Surface::CreateSurfaceAsConsumer();
348 if (surface == nullptr) {
349 MEDIA_ERR_LOG("Failed to get previewOutput surface");
350 return INVALID_ARGUMENT;
351 }
352 surface->SetUserData(CameraManager::surfaceFormat, std::to_string(profile.GetCameraFormat()));
353 int32_t retCode = manager_->CreatePreviewOutput(profile, surface, &previewOutput);
354 if (retCode != CameraErrorCode::SUCCESS) {
355 return SERVICE_FATL_ERROR;
356 }
357 return SUCCESS;
358 }
359
CreatePhotoOutputWithoutSurface(Profile & profile,sptr<PhotoOutput> & photoOutput)360 int32_t CameraMovingPhotoModuleTest::CreatePhotoOutputWithoutSurface(Profile &profile,
361 sptr<PhotoOutput> &photoOutput)
362 {
363 sptr<Surface> surface = Surface::CreateSurfaceAsConsumer(DEFAULT_SURFACEID);
364 CHECK_RETURN_RET_ELOG(surface == nullptr, INVALID_ARGUMENT,
365 "Failed to get photoOutput surface");
366
367 photoSurface_ = surface;
368 surface->SetUserData(CameraManager::surfaceFormat, std::to_string(profile.GetCameraFormat()));
369 sptr<IBufferProducer> surfaceProducer = surface->GetProducer();
370 CHECK_RETURN_RET_ELOG(surfaceProducer == nullptr, SERVICE_FATL_ERROR, "Get producer failed");
371
372 int32_t retCode = manager_->CreatePhotoOutput(profile, surfaceProducer, &photoOutput_);
373 CHECK_RETURN_RET_ELOG((retCode != CameraErrorCode::SUCCESS || photoOutput_ == nullptr),
374 SERVICE_FATL_ERROR, "Create photo output failed");
375
376 photoOutput_->SetNativeSurface(true);
377 return SUCCESS;
378 }
379
onPhotoAssetAvailable(PhotoOutput * photoOutput,OH_MediaAsset * mediaAsset)380 void CameraMovingPhotoModuleTest::onPhotoAssetAvailable(PhotoOutput *photoOutput, OH_MediaAsset *mediaAsset)
381 {
382 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::onPhotoAssetAvailable");
383 mediaAsset_ = mediaAsset;
384 }
385
onMovingPhotoDataPrepared(MediaLibrary_ErrorCode result,MediaLibrary_RequestId requestId,MediaLibrary_MediaQuality mediaQuality,MediaLibrary_MediaContentType type,OH_MovingPhoto * movingPhoto)386 void CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared(MediaLibrary_ErrorCode result,
387 MediaLibrary_RequestId requestId, MediaLibrary_MediaQuality mediaQuality,
388 MediaLibrary_MediaContentType type, OH_MovingPhoto* movingPhoto)
389 {
390 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared");
391 if (!movingPhoto) {
392 MEDIA_ERR_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared moving photo is nullptr");
393 return;
394 }
395 movingPhoto_ = movingPhoto;
396
397 OH_MediaAssetChangeRequest *changeRequest_ = OH_MediaAssetChangeRequest_Create(mediaAsset_);
398 if (!changeRequest_) {
399 MEDIA_ERR_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared create media asset change request fail");
400 return;
401 }
402
403 MediaLibrary_ErrorCode errCode = OH_MediaAssetChangeRequest_SaveCameraPhoto(changeRequest_,
404 MediaLibrary_ImageFileType::MEDIA_LIBRARY_IMAGE_JPEG);
405 if (errCode != MEDIA_LIBRARY_OK) {
406 MEDIA_ERR_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared save camera photo fail");
407 return;
408 }
409
410 errCode = OH_MediaAccessHelper_ApplyChanges(changeRequest_);
411 if (errCode != MEDIA_LIBRARY_OK) {
412 MEDIA_ERR_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared apply changes fail");
413 return;
414 }
415
416 const char *uri = nullptr;
417 errCode = OH_MovingPhoto_GetUri(movingPhoto_, &uri);
418 if (errCode != MEDIA_LIBRARY_OK || uri == nullptr) {
419 MEDIA_ERR_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared get uri fail");
420 return;
421 }
422 MEDIA_INFO_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared get uri is %{public}s", uri);
423
424 errCode = OH_MediaAssetChangeRequest_Release(changeRequest_);
425 if (errCode != MEDIA_LIBRARY_OK) {
426 MEDIA_ERR_LOG("CameraMovingPhotoModuleTest::onMovingPhotoDataPrepared release change request fail");
427 return;
428 }
429 }
430
MediaAssetManagerRequestMovingPhoto(OH_MediaLibrary_OnMovingPhotoDataPrepared callback)431 int32_t CameraMovingPhotoModuleTest::MediaAssetManagerRequestMovingPhoto(
432 OH_MediaLibrary_OnMovingPhotoDataPrepared callback)
433 {
434 mediaAssetManager_ = OH_MediaAssetManager_Create();
435 CHECK_RETURN_RET_ELOG(mediaAssetManager_ == nullptr, SERVICE_FATL_ERROR,
436 "Create media asset manager failed");
437
438 MediaLibrary_RequestId requestId;
439 MediaLibrary_RequestOptions requestOptions;
440 requestOptions.deliveryMode = MEDIA_LIBRARY_HIGH_QUALITY_MODE;
441 int32_t result = OH_MediaAssetManager_RequestMovingPhoto(mediaAssetManager_, mediaAsset_, requestOptions,
442 &requestId, callback);
443 CHECK_RETURN_RET_ELOG(result != MEDIA_LIBRARY_OK, SERVICE_FATL_ERROR,
444 "media asset manager request moving photo failed");
445 return SUCCESS;
446 }
447
ReleaseMediaAsset()448 void CameraMovingPhotoModuleTest::ReleaseMediaAsset()
449 {
450 if (mediaAsset_) {
451 OH_MediaAsset_Release(mediaAsset_);
452 mediaAsset_ = nullptr;
453 }
454 if (movingPhoto_) {
455 OH_MovingPhoto_Release(movingPhoto_);
456 movingPhoto_ = nullptr;
457 }
458 if (mediaAssetManager_) {
459 OH_MediaAssetManager_Release(mediaAssetManager_);
460 mediaAssetManager_ = nullptr;
461 }
462 }
463
464 /*
465 * Feature: Framework
466 * Function: Test the normal scenario of movingphoto.
467 * SubFunction: NA
468 * FunctionPoints: NA
469 * EnvConditions: NA
470 * CaseDescription: Test the normal scenario of movingphoto,Call the EnableMovingPhoto function
471 * after submitting the camera settings,and expect the movingphoto feature can be turned on successfully.
472 */
473 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_001, TestSize.Level0)
474 {
475 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
476 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
477 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
478 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
479 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
480
481 if (session_->IsMovingPhotoSupported()) {
482 session_->LockForControl();
483 EXPECT_EQ(session_->EnableMovingPhoto(true), CameraErrorCode::SUCCESS);
484 session_->UnlockForControl();
485 }
486
487 EXPECT_EQ(session_->Start(), SUCCESS);
488 sleep(WAIT_TIME_AFTER_START);
489
490 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
491 sleep(WAIT_TIME_AFTER_CAPTURE);
492
493 EXPECT_EQ(session_->Stop(), SUCCESS);
494 }
495
496 /*
497 * Feature: Framework
498 * Function: Test the abnormal scenario of movingphoto.
499 * SubFunction: NA
500 * FunctionPoints: NA
501 * EnvConditions: NA
502 * CaseDescription: Test the abnormal scenario of movingphoto,Call the EnableMovingPhoto function then tunrn off
503 * after submitting the camera settings,and expect the movingphoto feature can not be turned on successfully.
504 */
505 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_002, TestSize.Level0)
506 {
507 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
508 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
509 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
510 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
511 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
512
513 if (session_->IsMovingPhotoSupported()) {
514 session_->LockForControl();
515 EXPECT_EQ(session_->EnableMovingPhoto(true), CameraErrorCode::SUCCESS);
516 session_->UnlockForControl();
517 EXPECT_EQ(session_->IsMovingPhotoEnabled(), true);
518 session_->LockForControl();
519 EXPECT_EQ(session_->EnableMovingPhoto(false), CameraErrorCode::SUCCESS);
520 session_->UnlockForControl();
521 EXPECT_EQ(session_->IsMovingPhotoEnabled(), false);
522 }
523
524 EXPECT_EQ(session_->Start(), SUCCESS);
525 sleep(WAIT_TIME_AFTER_START);
526
527 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
528 sleep(WAIT_TIME_AFTER_CAPTURE);
529
530 EXPECT_EQ(session_->Stop(), SUCCESS);
531 }
532
533 /*
534 * Feature: Framework
535 * Function: Test the normal scenario of movingphoto.
536 * SubFunction: NA
537 * FunctionPoints: NA
538 * EnvConditions: NA
539 * CaseDescription: Test the normal scenario of movingphoto,Call the EnableMovingPhotoMirror function
540 * after submitting the camera settings,and expect the movingphotomirror feature can be turned on successfully.
541 */
542 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_003, TestSize.Level1)
543 {
544 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
545 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
546 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
547 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
548 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
549
550 if (session_->IsMovingPhotoSupported()) {
551 session_->LockForControl();
552 EXPECT_EQ(session_->EnableMovingPhoto(true), CameraErrorCode::SUCCESS);
553 session_->UnlockForControl();
554 EXPECT_EQ(session_->EnableMovingPhotoMirror(true, true), CameraErrorCode::SUCCESS);
555 }
556
557 EXPECT_EQ(session_->Start(), SUCCESS);
558 sleep(WAIT_TIME_AFTER_START);
559
560 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
561 sleep(WAIT_TIME_AFTER_CAPTURE);
562
563 EXPECT_EQ(session_->Stop(), SUCCESS);
564 }
565
566 /*
567 * Feature: Framework
568 * Function: Test the normal scenario of movingphoto.
569 * SubFunction: NA
570 * FunctionPoints: NA
571 * EnvConditions: NA
572 * CaseDescription: Test the normal scenario of movingphoto,Call the EnableMovingPhotoMirror function then tunrn off
573 * after submitting the camera settings,and expect the movingphotomirror feature can be turned on successfully.
574 */
575 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_004, TestSize.Level1)
576 {
577 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
578 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
579 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
580 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
581 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
582
583 if (session_->IsMovingPhotoSupported()) {
584 session_->LockForControl();
585 EXPECT_EQ(session_->EnableMovingPhoto(true), CameraErrorCode::SUCCESS);
586 session_->UnlockForControl();
587 EXPECT_EQ(session_->EnableMovingPhotoMirror(true, true), CameraErrorCode::SUCCESS);
588 EXPECT_EQ(session_->EnableMovingPhotoMirror(false, true), CameraErrorCode::SUCCESS);
589 }
590
591 EXPECT_EQ(session_->Start(), SUCCESS);
592 sleep(WAIT_TIME_AFTER_START);
593
594 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
595 sleep(WAIT_TIME_AFTER_CAPTURE);
596
597 EXPECT_EQ(session_->Stop(), SUCCESS);
598 }
599
600 /*
601 * Feature: Framework
602 * Function: Test the abnormal scenario of movingphoto.
603 * SubFunction: NA
604 * FunctionPoints: NA
605 * EnvConditions: NA
606 * CaseDescription: Test the abnormal scenario of movingphoto,Call the EnableMovingPhoto function
607 * before starting the camera settings,and expect the movingphoto feature can not be turned on successfully.
608 */
609 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_005, TestSize.Level1)
610 {
611 if (session_->IsMovingPhotoSupported()) {
612 session_->LockForControl();
613 EXPECT_EQ(session_->EnableMovingPhoto(true), CameraErrorCode::SERVICE_FATL_ERROR);
614 session_->UnlockForControl();
615 }
616
617 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
618 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
619 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
620 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
621 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
622
623 EXPECT_EQ(session_->Start(), SUCCESS);
624 sleep(WAIT_TIME_AFTER_START);
625
626 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
627 sleep(WAIT_TIME_AFTER_CAPTURE);
628
629 EXPECT_EQ(session_->Stop(), SUCCESS);
630 }
631
632 /*
633 * Feature: Framework
634 * Function: Test the abnormal scenario of movingphoto.
635 * SubFunction: NA
636 * FunctionPoints: NA
637 * EnvConditions: NA
638 * CaseDescription: Test the abnormal scenario of movingphoto,Call the EnableMovingPhoto function
639 * before submitting the camera settings,and expect the movingphoto feature can not be turned on successfully.
640 */
641 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_006, TestSize.Level1)
642 {
643 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
644 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
645 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
646 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
647 if (session_->IsMovingPhotoSupported()) {
648 session_->LockForControl();
649 EXPECT_EQ(session_->EnableMovingPhoto(true), CameraErrorCode::SUCCESS);
650 session_->UnlockForControl();
651 }
652 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
653
654 EXPECT_EQ(session_->Start(), SUCCESS);
655 sleep(WAIT_TIME_AFTER_START);
656
657 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
658 sleep(WAIT_TIME_AFTER_CAPTURE);
659
660 EXPECT_EQ(session_->Stop(), SUCCESS);
661 }
662
663 /*
664 * Feature: Framework
665 * Function: Test the normal scenario of movingphoto.
666 * SubFunction: NA
667 * FunctionPoints: NA
668 * EnvConditions: NA
669 * CaseDescription: Test the normal scenario of movingphoto.
670 */
671 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_007, TestSize.Level1)
672 {
673 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
674 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
675 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
676 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
677 PhotoOutputTest_PhotoAssetAvailable photoAssetCallback = onPhotoAssetAvailable;
678 EXPECT_EQ(RegisterPhotoAssetAvailableCallback(photoAssetCallback), SUCCESS);
679 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
680
681 if (!session_->IsMovingPhotoSupported()) {
682 MEDIA_ERR_LOG("Camera device not support moving photo");
683 GTEST_SKIP();
684 }
685 session_->LockForControl();
686 EXPECT_EQ(session_->EnableMovingPhoto(true), SUCCESS);
687 session_->UnlockForControl();
688
689 EXPECT_EQ(session_->Start(), SUCCESS);
690 sleep(WAIT_TIME_AFTER_START);
691
692 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
693 sleep(WAIT_TIME_AFTER_CAPTURE);
694
695 if (!mediaAsset_) {
696 MEDIA_ERR_LOG("Midia asset is null after register photo asset available callback");
697 GTEST_SKIP();
698 }
699
700 MediaLibrary_MediaSubType mediaSubType = MEDIA_LIBRARY_DEFAULT;
701 EXPECT_EQ(OH_MediaAsset_GetMediaSubType(mediaAsset_, &mediaSubType), MEDIA_LIBRARY_OK);
702 EXPECT_EQ(mediaSubType, MediaLibrary_MediaSubType::MEDIA_LIBRARY_MOVING_PHOTO);
703
704 EXPECT_EQ(session_->Stop(), SUCCESS);
705 }
706
707 /*
708 * Feature: Framework
709 * Function: Test the normal scenario of movingphoto.
710 * SubFunction: NA
711 * FunctionPoints: NA
712 * EnvConditions: NA
713 * CaseDescription: Test the normal scenario of movingphoto with enable moving photo mirror.
714 */
715 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_008, TestSize.Level1)
716 {
717 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
718 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
719 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
720 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
721 PhotoOutputTest_PhotoAssetAvailable photoAssetCallback = onPhotoAssetAvailable;
722 EXPECT_EQ(RegisterPhotoAssetAvailableCallback(photoAssetCallback), SUCCESS);
723 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
724
725 if (!session_->IsMovingPhotoSupported()) {
726 MEDIA_ERR_LOG("Camera device not support moving photo");
727 GTEST_SKIP();
728 }
729 session_->LockForControl();
730 EXPECT_EQ(session_->EnableMovingPhoto(true), SUCCESS);
731 EXPECT_EQ(session_->EnableMovingPhotoMirror(true, true), SUCCESS);
732 session_->UnlockForControl();
733
734 EXPECT_EQ(session_->Start(), SUCCESS);
735 sleep(WAIT_TIME_AFTER_START);
736
737 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
738 sleep(WAIT_TIME_AFTER_CAPTURE);
739
740 if (!mediaAsset_) {
741 MEDIA_ERR_LOG("Midia asset is null after register photo asset available callback");
742 GTEST_SKIP();
743 }
744
745 MediaLibrary_MediaSubType mediaSubType = MEDIA_LIBRARY_DEFAULT;
746 EXPECT_EQ(OH_MediaAsset_GetMediaSubType(mediaAsset_, &mediaSubType), MEDIA_LIBRARY_OK);
747 EXPECT_EQ(mediaSubType, MediaLibrary_MediaSubType::MEDIA_LIBRARY_MOVING_PHOTO);
748
749 EXPECT_EQ(session_->Stop(), SUCCESS);
750 }
751
752 /*
753 * Feature: Framework
754 * Function: Test the abnormal scenario of movingphoto.
755 * SubFunction: NA
756 * FunctionPoints: NA
757 * EnvConditions: NA
758 * CaseDescription: Test the abnormal scenario of movingphoto with PhotoAssetAvailableCallback is null.
759 */
760 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_009, TestSize.Level1)
761 {
762 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
763 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
764 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
765 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
766 PhotoOutputTest_PhotoAssetAvailable callback = nullptr;
767 EXPECT_EQ(RegisterPhotoAssetAvailableCallback(callback), SUCCESS);
768 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
769
770 if (!session_->IsMovingPhotoSupported()) {
771 MEDIA_ERR_LOG("Camera device not support moving photo");
772 GTEST_SKIP();
773 }
774 session_->LockForControl();
775 EXPECT_EQ(session_->EnableMovingPhoto(true), SUCCESS);
776 session_->UnlockForControl();
777
778 EXPECT_EQ(session_->Start(), SUCCESS);
779 sleep(WAIT_TIME_AFTER_START);
780
781 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
782 sleep(WAIT_TIME_AFTER_CAPTURE);
783
784 EXPECT_EQ(mediaAsset_, nullptr);
785
786 EXPECT_EQ(session_->Stop(), SUCCESS);
787 }
788
789 /*
790 * Feature: Framework
791 * Function: Test the abnormal scenario of movingphoto.
792 * SubFunction: NA
793 * FunctionPoints: NA
794 * EnvConditions: NA
795 * CaseDescription: Test the abnormal scenario of movingphoto with MovingPhotoDataPrepared is null.
796 */
797 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_010, TestSize.Level1)
798 {
799 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
800 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
801 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
802 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
803 PhotoOutputTest_PhotoAssetAvailable photoAssetCallback = onPhotoAssetAvailable;
804 EXPECT_EQ(RegisterPhotoAssetAvailableCallback(photoAssetCallback), SUCCESS);
805 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
806
807 if (!session_->IsMovingPhotoSupported()) {
808 MEDIA_ERR_LOG("Camera device not support moving photo");
809 GTEST_SKIP();
810 }
811 session_->LockForControl();
812 EXPECT_EQ(session_->EnableMovingPhoto(true), SUCCESS);
813 session_->UnlockForControl();
814
815 EXPECT_EQ(session_->Start(), SUCCESS);
816 sleep(WAIT_TIME_AFTER_START);
817
818 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
819 sleep(WAIT_TIME_AFTER_CAPTURE);
820
821 if (!mediaAsset_) {
822 MEDIA_ERR_LOG("Midia asset is null after register photo asset available callback");
823 GTEST_SKIP();
824 }
825
826 OH_MediaLibrary_OnMovingPhotoDataPrepared movingPhotoCallback = nullptr;
827 EXPECT_EQ(MediaAssetManagerRequestMovingPhoto(movingPhotoCallback), SERVICE_FATL_ERROR);
828 sleep(WAIT_TIME_CALLBACK);
829
830 EXPECT_EQ(movingPhoto_, nullptr);
831
832 EXPECT_EQ(session_->Stop(), SUCCESS);
833 }
834
835 /*
836 * Feature: Framework
837 * Function: Test the abnormal scenario of movingphoto.
838 * SubFunction: NA
839 * FunctionPoints: NA
840 * EnvConditions: NA
841 * CaseDescription: Test the abnormal scenario of movingphoto with disable moving photo.
842 */
843 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_011, TestSize.Level1)
844 {
845 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
846 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
847 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
848 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
849 PhotoOutputTest_PhotoAssetAvailable photoAssetCallback = onPhotoAssetAvailable;
850 EXPECT_EQ(RegisterPhotoAssetAvailableCallback(photoAssetCallback), SUCCESS);
851 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
852
853 if (!session_->IsMovingPhotoSupported()) {
854 MEDIA_ERR_LOG("Camera device not support moving photo");
855 GTEST_SKIP();
856 }
857 session_->LockForControl();
858 EXPECT_EQ(session_->EnableMovingPhoto(false), SUCCESS);
859 session_->UnlockForControl();
860
861 EXPECT_EQ(session_->Start(), SUCCESS);
862 sleep(WAIT_TIME_AFTER_START);
863
864 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
865 sleep(WAIT_TIME_AFTER_CAPTURE);
866
867 if (!mediaAsset_) {
868 MEDIA_ERR_LOG("Midia asset is null after register photo asset available callback");
869 GTEST_SKIP();
870 }
871
872 MediaLibrary_MediaSubType mediaSubType = MEDIA_LIBRARY_DEFAULT;
873 EXPECT_EQ(OH_MediaAsset_GetMediaSubType(mediaAsset_, &mediaSubType), MEDIA_LIBRARY_OK);
874 EXPECT_NE(mediaSubType, MediaLibrary_MediaSubType::MEDIA_LIBRARY_MOVING_PHOTO);
875
876 EXPECT_EQ(session_->Stop(), SUCCESS);
877 }
878
879 /*
880 * Feature: Framework
881 * Function: Test the abnormal scenario of movingphoto.
882 * SubFunction: NA
883 * FunctionPoints: NA
884 * EnvConditions: NA
885 * CaseDescription: Test the abnormal scenario of movingphoto with UnregisterPhotoAssetAvailableCallback.
886 */
887 HWTEST_F(CameraMovingPhotoModuleTest, camera_moving_photo_moduletest_012, TestSize.Level1)
888 {
889 EXPECT_EQ(session_->BeginConfig(), SUCCESS);
890 EXPECT_EQ(session_->AddInput((sptr<CaptureInput>&)input_), SUCCESS);
891 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)previewOutput_), SUCCESS);
892 EXPECT_EQ(session_->AddOutput((sptr<CaptureOutput>&)photoOutput_), SUCCESS);
893 PhotoOutputTest_PhotoAssetAvailable photoAssetCallback = onPhotoAssetAvailable;
894 EXPECT_EQ(RegisterPhotoAssetAvailableCallback(photoAssetCallback), SUCCESS);
895 EXPECT_EQ(session_->CommitConfig(), SUCCESS);
896
897 if (!session_->IsMovingPhotoSupported()) {
898 MEDIA_ERR_LOG("Camera device not support moving photo");
899 GTEST_SKIP();
900 }
901 session_->LockForControl();
902 EXPECT_EQ(session_->EnableMovingPhoto(true), SUCCESS);
903 session_->UnlockForControl();
904
905 EXPECT_EQ(session_->Start(), SUCCESS);
906 sleep(WAIT_TIME_AFTER_START);
907
908 ReleaseMediaAsset();
909 UnregisterPhotoAssetAvailableCallback(photoAssetCallback);
910
911 EXPECT_EQ(photoOutput_->Capture(), SUCCESS);
912 sleep(WAIT_TIME_AFTER_CAPTURE);
913 ASSERT_EQ(mediaAsset_, nullptr);
914
915 EXPECT_EQ(session_->Stop(), SUCCESS);
916 }
917
918 } // namespace CameraStandard
919 } // namespace OHOS