• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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_deferred_proc_unittest.h"
17 #include "deferred_video_proc_session.h"
18 
19 #include "dp_log.h"
20 #include "picture_proxy.h"
21 #include "pixel_map.h"
22 
23 #include "access_token.h"
24 #include "accesstoken_kit.h"
25 
26 #include "gtest/gtest.h"
27 #include "hap_token_info.h"
28 #include "ipc_skeleton.h"
29 #include "nativetoken_kit.h"
30 #include "os_account_manager.h"
31 
32 #include "token_setproc.h"
33 #include "picture_interface.h"
34 #include "test_token.h"
35 
36 namespace OHOS {
37 namespace CameraStandard {
38 using namespace testing::ext;
39 using namespace DeferredProcessing;
40 
41 constexpr int32_t SIZE_WIDTH = 2;
42 constexpr int32_t SIZE_HEIGHT = 3;
43 constexpr int32_t BUFFER_LENGTH = 8;
44 constexpr int VIDEO_REQUEST_FD_ID = 1;
45 
46 class TestDeferredPhotoProcSessionCallback : public IDeferredPhotoProcSessionCallback {
47 public:
OnProcessImageDone(const std::string & imageId,std::shared_ptr<PictureIntf> picture,uint32_t cloudImageEnhanceFlag)48     void OnProcessImageDone(const std::string &imageId, std::shared_ptr<PictureIntf> picture,
49         uint32_t cloudImageEnhanceFlag) {}
OnDeliveryLowQualityImage(const std::string & imageId,std::shared_ptr<PictureIntf> picture)50     void OnDeliveryLowQualityImage(const std::string &imageId, std::shared_ptr<PictureIntf> picture) {}
OnProcessImageDone(const std::string & imageId,const uint8_t * addr,const long bytes,uint32_t cloudImageEnhanceFlag)51     void OnProcessImageDone(const std::string& imageId, const uint8_t* addr, const long bytes,
52         uint32_t cloudImageEnhanceFlag) {}
OnError(const std::string & imageId,const DpsErrorCode errorCode)53     void OnError(const std::string& imageId, const DpsErrorCode errorCode) {}
OnStateChanged(const DpsStatusCode status)54     void OnStateChanged(const DpsStatusCode status) {}
55 };
56 
57 class TestDeferredVideoProcSessionCallback : public IDeferredVideoProcSessionCallback {
58 public:
OnProcessVideoDone(const std::string & videoId,const sptr<IPCFileDescriptor> ipcFd)59     void OnProcessVideoDone(const std::string& videoId, const sptr<IPCFileDescriptor> ipcFd) {}
OnError(const std::string & videoId,const DpsErrorCode errorCode)60     void OnError(const std::string& videoId, const DpsErrorCode errorCode) {}
OnStateChanged(const DpsStatusCode status)61     void OnStateChanged(const DpsStatusCode status) {}
62 };
63 
GetPictureIntfInstance()64 std::shared_ptr<PictureIntf> GetPictureIntfInstance()
65 {
66     auto pictureProxy = PictureProxy::CreatePictureProxy();
67     DP_CHECK_ERROR_PRINT_LOG(pictureProxy == nullptr || pictureProxy.use_count() != 1,
68         "pictureProxy use count is not 1");
69     return pictureProxy;
70 }
71 
SetUpTestCase(void)72 void DeferredProcUnitTest::SetUpTestCase(void)
73 {
74     ASSERT_TRUE(TestToken().GetAllCameraPermission());
75 }
76 
TearDownTestCase(void)77 void DeferredProcUnitTest::TearDownTestCase(void)
78 {
79     DP_DEBUG_LOG("DeferredProcUnitTest::TearDownTestCase started!");
80 }
81 
SetUp()82 void DeferredProcUnitTest::SetUp()
83 {
84     const uint32_t color[BUFFER_LENGTH] = { 0x80, 0x02, 0x04, 0x08, 0x40, 0x02, 0x04, 0x08 };
85     Media::InitializationOptions options;
86     options.size.width = SIZE_WIDTH;
87     options.size.height = SIZE_HEIGHT;
88     options.srcPixelFormat = Media::PixelFormat::UNKNOWN;
89     options.pixelFormat = Media::PixelFormat::UNKNOWN;
90     options.alphaType = Media::AlphaType::IMAGE_ALPHA_TYPE_OPAQUE;
91     std::shared_ptr<Media::PixelMap> pixelmap = Media::PixelMap::Create(color, BUFFER_LENGTH, options);
92     EXPECT_NE(pixelmap, nullptr);
93     auto picture = GetPictureIntfInstance();
94     if (picture == nullptr) {
95         picture_ = nullptr;
96     } else {
97         picture_ = picture;
98     }
99 }
100 
TearDown()101 void DeferredProcUnitTest::TearDown()
102 {
103     DP_DEBUG_LOG("DeferredProcUnitTest::TearDown started!");
104 }
105 
106 /*
107  * Feature: Framework
108  * Function: Test is that the class calls the function function correctly and functions properly.
109  * SubFunction: NA
110  * FunctionPoints: NA
111  * EnvConditions: NA
112  * CaseDescription: Test is that the class calls the function function correctly and functions properly.
113  */
114 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_001, TestSize.Level0)
115 {
116     sptr<DeferredPhotoProcSession> deferredProcSession =
117         new(std::nothrow) DeferredPhotoProcSession(userId_, std::make_shared<TestDeferredPhotoProcSessionCallback>());
118     ASSERT_NE(deferredProcSession, nullptr);
119     deferredProcSession->BeginSynchronize();
120 
121     std::string imageId = "testImageId";
122     DpsMetadata metadata;
123     bool discardable = true;
124     deferredProcSession->AddImage(imageId, metadata, discardable);
125 
126     bool restorable = true;
127     deferredProcSession->RemoveImage(imageId, restorable);
128 
129     deferredProcSession->RestoreImage(imageId);
130 
131     std::string appName = "com.cameraFwk.ut";
132     deferredProcSession->ProcessImage(appName, imageId);
133 
134     bool ret = deferredProcSession->CancelProcessImage(imageId);
135     EXPECT_TRUE(ret);
136 
137     deferredProcSession->EndSynchronize();
138 
139     pid_t pid = 0;
140     deferredProcSession->CameraServerDied(pid);
141 
142     auto callback = deferredProcSession->GetCallback();
143     EXPECT_NE(callback, nullptr);
144 }
145 
146 /*
147  * Feature: Framework
148  * Function: Test exception constructs the function that calls the function properly.
149  * SubFunction: NA
150  * FunctionPoints: NA
151  * EnvConditions: NA
152  * CaseDescription: Test exception constructs the function that calls the function properly.
153  */
154 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_002, TestSize.Level0)
155 {
156     sptr<DeferredPhotoProcSession> deferredProcSession =
157         new(std::nothrow) DeferredPhotoProcSession(userId_, std::make_shared<TestDeferredPhotoProcSessionCallback>());
158     ASSERT_NE(deferredProcSession, nullptr);
159     EXPECT_EQ(deferredProcSession->remoteSession_, nullptr);
160     deferredProcSession->BeginSynchronize();
161 
162     std::string imageId = "testImageId";
163     DpsMetadata metadata;
164     bool discardable = true;
165     deferredProcSession->AddImage(imageId, metadata, discardable);
166 
167     bool restorable = true;
168     deferredProcSession->RemoveImage(imageId, restorable);
169 
170     deferredProcSession->RestoreImage(imageId);
171 
172     std::string appName = "com.cameraFwk.ut";
173     deferredProcSession->ProcessImage(appName, imageId);
174 
175     bool ret = deferredProcSession->CancelProcessImage(imageId);
176     EXPECT_TRUE(!ret);
177 
178     deferredProcSession->EndSynchronize();
179 
180     pid_t pid = 0;
181     deferredProcSession->CameraServerDied(pid);
182     EXPECT_NE(deferredProcSession->deathRecipient_, nullptr);
183 }
184 
185 /*
186  * Feature: Framework
187  * Function: Test the construction class calls the listener function, and the function functions normally.
188  * SubFunction: NA
189  * FunctionPoints: NA
190  * EnvConditions: NA
191  * CaseDescription: Test the construction class calls the listener function, and the function functions normally.
192  */
193 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_003, TestSize.Level0)
194 {
195     sptr<DeferredPhotoProcSession> deferredProcSession =
196         new(std::nothrow) DeferredPhotoProcSession(userId_, std::make_shared<TestDeferredPhotoProcSessionCallback>());
197     ASSERT_NE(deferredProcSession, nullptr);
198     sptr<DeferredPhotoProcessingSessionCallback> remoteCallback =
199         new(std::nothrow) DeferredPhotoProcessingSessionCallback(deferredProcSession);
200     ASSERT_NE(remoteCallback, nullptr);
201 
202     std::string imageId = "testImageId";
203     bool restorable = true;
204     int32_t ret = 0;
205     ret = remoteCallback->OnProcessImageDone(imageId, nullptr, restorable);
206     EXPECT_EQ(ret, 0);
207 
208     ret = remoteCallback->OnProcessImageDone(imageId, picture_, restorable);
209     EXPECT_EQ(ret, 0);
210 
211     sptr<IPCFileDescriptor> ipcFd = sptr<IPCFileDescriptor>::MakeSptr(dup(VIDEO_REQUEST_FD_ID));
212     EXPECT_NE(ipcFd, nullptr);
213     long bytes = sizeof(ipcFd);
214     ret = remoteCallback->OnProcessImageDone(imageId, ipcFd, bytes, restorable);
215     EXPECT_EQ(ret, 0);
216 
217     ret = remoteCallback->OnDeliveryLowQualityImage(imageId, picture_);
218     EXPECT_EQ(ret, 0);
219 
220     DeferredProcessing::ErrorCode errorCode = DeferredProcessing::ErrorCode::ERROR_SESSION_SYNC_NEEDED;
221     ret = remoteCallback->OnError(imageId, errorCode);
222     EXPECT_EQ(ret, 0);
223 
224     DeferredProcessing::StatusCode status = DeferredProcessing::StatusCode::SESSION_STATE_IDLE;
225     ret = remoteCallback->OnStateChanged(status);
226     EXPECT_EQ(ret, 0);
227 }
228 
229 /*
230  * Feature: Framework
231  * Function: When the callback is not implemented, the callback function is called normally.
232  * SubFunction: NA
233  * FunctionPoints: NA
234  * EnvConditions: NA
235  * CaseDescription: When the callback is not implemented, the callback function is called normally.
236  */
237 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_004, TestSize.Level0)
238 {
239     sptr<DeferredPhotoProcSession> deferredProcSession = new(std::nothrow) DeferredPhotoProcSession(userId_, nullptr);
240     ASSERT_NE(deferredProcSession, nullptr);
241     sptr<DeferredPhotoProcessingSessionCallback> remoteCallback =
242         new(std::nothrow) DeferredPhotoProcessingSessionCallback(deferredProcSession);
243     ASSERT_NE(remoteCallback, nullptr);
244 
245     std::string imageId = "testImageId";
246     bool restorable = true;
247     int32_t ret = 0;
248     ret = remoteCallback->OnProcessImageDone(imageId, picture_, restorable);
249     EXPECT_EQ(ret, 0);
250 
251     sptr<IPCFileDescriptor> ipcFd = sptr<IPCFileDescriptor>::MakeSptr(dup(VIDEO_REQUEST_FD_ID));
252     EXPECT_NE(ipcFd, nullptr);
253     long bytes = sizeof(ipcFd);
254     ret = remoteCallback->OnProcessImageDone(imageId, ipcFd, bytes, restorable);
255     EXPECT_EQ(ret, 0);
256 
257     ret = remoteCallback->OnDeliveryLowQualityImage(imageId, nullptr);
258     EXPECT_EQ(ret, 0);
259 
260     DeferredProcessing::ErrorCode errorCode = DeferredProcessing::ErrorCode::ERROR_SESSION_SYNC_NEEDED;
261     ret = remoteCallback->OnError(imageId, errorCode);
262     EXPECT_EQ(ret, 0);
263 
264     DeferredProcessing::StatusCode status = DeferredProcessing::StatusCode::SESSION_STATE_IDLE;
265     ret = remoteCallback->OnStateChanged(status);
266     EXPECT_EQ(ret, 0);
267 }
268 
269 /*
270  * Feature: Framework
271  * Function: When the test does not implement the callback, the function call is normal.
272  * SubFunction: NA
273  * FunctionPoints: NA
274  * EnvConditions: NA
275  * CaseDescription: When the test does not implement the callback, the function call is normal.
276  */
277 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_005, TestSize.Level0)
278 {
279     sptr<DeferredPhotoProcSession> deferredProcSession =
280         new(std::nothrow) DeferredPhotoProcSession(userId_, std::make_shared<TestDeferredPhotoProcSessionCallback>());
281     ASSERT_NE(deferredProcSession, nullptr);
282     sptr<DeferredPhotoProcessingSessionCallback> remoteCallback =
283         new(std::nothrow) DeferredPhotoProcessingSessionCallback();
284     ASSERT_NE(remoteCallback, nullptr);
285 
286     std::string imageId = "testImageId";
287     bool restorable = true;
288     int32_t ret = 0;
289     ret = remoteCallback->OnProcessImageDone(imageId, picture_, restorable);
290     EXPECT_EQ(ret, 0);
291 
292     sptr<IPCFileDescriptor> ipcFd = sptr<IPCFileDescriptor>::MakeSptr(dup(VIDEO_REQUEST_FD_ID));
293     EXPECT_NE(ipcFd, nullptr);
294     long bytes = sizeof(ipcFd);
295     ret = remoteCallback->OnProcessImageDone(imageId, ipcFd, bytes, restorable);
296     EXPECT_EQ(ret, 0);
297 
298     DeferredProcessing::ErrorCode errorCode = DeferredProcessing::ErrorCode::ERROR_SESSION_SYNC_NEEDED;
299     ret = remoteCallback->OnError(imageId, errorCode);
300     EXPECT_EQ(ret, 0);
301 
302     DeferredProcessing::StatusCode status = DeferredProcessing::StatusCode::SESSION_STATE_IDLE;
303     ret = remoteCallback->OnStateChanged(status);
304     EXPECT_EQ(ret, 0);
305 }
306 
307 /*
308  * Feature: Framework
309  * Function: The test function is returned abnormally.
310  * SubFunction: NA
311  * FunctionPoints: NA
312  * EnvConditions: NA
313  * CaseDescription: The test function is returned abnormally.
314  */
315 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_006, TestSize.Level0)
316 {
317     sptr<DeferredPhotoProcSession> deferredProcSession = new(std::nothrow) DeferredPhotoProcSession(userId_, nullptr);
318     ASSERT_NE(deferredProcSession, nullptr);
319     sptr<DeferredPhotoProcessingSessionCallback> remoteCallback =
320         new(std::nothrow) DeferredPhotoProcessingSessionCallback();
321     ASSERT_NE(remoteCallback, nullptr);
322 
323     std::string imageId = "testImageId";
324     bool restorable = true;
325     int32_t ret = 0;
326     ret = remoteCallback->OnProcessImageDone(imageId, picture_, restorable);
327     EXPECT_EQ(ret, 0);
328 
329     sptr<IPCFileDescriptor> ipcFd = sptr<IPCFileDescriptor>::MakeSptr(dup(VIDEO_REQUEST_FD_ID));
330     EXPECT_NE(ipcFd, nullptr);
331     long bytes = sizeof(ipcFd);
332     ret = remoteCallback->OnProcessImageDone(imageId, ipcFd, bytes, restorable);
333     EXPECT_EQ(ret, 0);
334 
335     DeferredProcessing::ErrorCode errorCode = DeferredProcessing::ErrorCode::ERROR_SESSION_SYNC_NEEDED;
336     ret = remoteCallback->OnError(imageId, errorCode);
337     EXPECT_EQ(ret, 0);
338 
339     DeferredProcessing::StatusCode status = DeferredProcessing::StatusCode::SESSION_STATE_IDLE;
340     ret = remoteCallback->OnStateChanged(status);
341     EXPECT_EQ(ret, 0);
342 }
343 
344 /*
345  * Feature: Framework
346  * Function: Test is that the class calls the function function correctly and functions properly.
347  * SubFunction: NA
348  * FunctionPoints: NA
349  * EnvConditions: NA
350  * CaseDescription: Test is that the class calls the function function correctly and functions properly.
351  */
352 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_007, TestSize.Level0)
353 {
354     sptr<DeferredVideoProcSession> deferredProcSession =
355         new(std::nothrow) DeferredVideoProcSession(userId_, std::make_shared<TestDeferredVideoProcSessionCallback>());
356     ASSERT_NE(deferredProcSession, nullptr);
357     deferredProcSession->BeginSynchronize();
358 
359     std::string videoId = "testVideoId";
360     sptr<IPCFileDescriptor> srcFd;
361     const sptr<IPCFileDescriptor> dstFd;
362     deferredProcSession->AddVideo(videoId, srcFd, dstFd);
363 
364     bool restorable = true;
365     deferredProcSession->RemoveVideo(videoId, restorable);
366 
367     deferredProcSession->RestoreVideo(videoId);
368 
369     deferredProcSession->EndSynchronize();
370 
371     pid_t pid = 0;
372     deferredProcSession->CameraServerDied(pid);
373 
374     auto callback = deferredProcSession->GetCallback();
375     EXPECT_NE(callback, nullptr);
376 }
377 
378 /*
379  * Feature: Framework
380  * Function: Test exception constructs the function that calls the function properly.
381  * SubFunction: NA
382  * FunctionPoints: NA
383  * EnvConditions: NA
384  * CaseDescription: Test exception constructs the function that calls the function properly.
385  */
386 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_008, TestSize.Level0)
387 {
388     sptr<DeferredVideoProcSession> deferredProcSession =
389         new(std::nothrow) DeferredVideoProcSession(userId_, std::make_shared<TestDeferredVideoProcSessionCallback>());
390     ASSERT_NE(deferredProcSession, nullptr);
391     EXPECT_EQ(deferredProcSession->remoteSession_, nullptr);
392 
393     deferredProcSession->BeginSynchronize();
394 
395     std::string videoId = "testVideoId";
396     sptr<IPCFileDescriptor> srcFd;
397     const sptr<IPCFileDescriptor> dstFd;
398     deferredProcSession->AddVideo(videoId, srcFd, dstFd);
399 
400     bool restorable = true;
401     deferredProcSession->RemoveVideo(videoId, restorable);
402 
403     deferredProcSession->RestoreVideo(videoId);
404 
405     deferredProcSession->EndSynchronize();
406 
407     pid_t pid = 0;
408     deferredProcSession->CameraServerDied(pid);
409 }
410 
411 /*
412  * Feature: Framework
413  * Function: Test the construction class calls the listener function, and the function functions normally.
414  * SubFunction: NA
415  * FunctionPoints: NA
416  * EnvConditions: NA
417  * CaseDescription: Test the construction class calls the listener function, and the function functions normally.
418  */
419 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_009, TestSize.Level0)
420 {
421     sptr<DeferredVideoProcSession> deferredProcSession =
422         new(std::nothrow) DeferredVideoProcSession(userId_, std::make_shared<TestDeferredVideoProcSessionCallback>());
423     ASSERT_NE(deferredProcSession, nullptr);
424 
425     sptr<DeferredVideoProcessingSessionCallback> remoteCallback =
426         new(std::nothrow) DeferredVideoProcessingSessionCallback(deferredProcSession);
427     ASSERT_NE(remoteCallback, nullptr);
428     std::string videoId = "testVideoId";
429     sptr<IPCFileDescriptor> ipcFileDescriptor;
430     int32_t ret = 0;
431     ret = remoteCallback->OnProcessVideoDone(videoId, ipcFileDescriptor);
432     EXPECT_EQ(ret, 0);
433 
434     int32_t errorCode = 0;
435     ret = remoteCallback->OnError(videoId, errorCode);
436     EXPECT_EQ(ret, 0);
437 
438     int32_t status = 0;
439     ret = remoteCallback->OnStateChanged(status);
440     EXPECT_EQ(ret, 0);
441 }
442 
443 /*
444  * Feature: Framework
445  * Function: When the callback is not implemented, the callback function is called normally.
446  * SubFunction: NA
447  * FunctionPoints: NA
448  * EnvConditions: NA
449  * CaseDescription: When the callback is not implemented, the callback function is called normally.
450  */
451 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_010, TestSize.Level0)
452 {
453     sptr<DeferredVideoProcSession> deferredProcSession =
454         new(std::nothrow) DeferredVideoProcSession(userId_, std::make_shared<TestDeferredVideoProcSessionCallback>());
455     ASSERT_NE(deferredProcSession, nullptr);
456     sptr<DeferredVideoProcessingSessionCallback> remoteCallback =
457         new(std::nothrow) DeferredVideoProcessingSessionCallback();
458     ASSERT_NE(remoteCallback, nullptr);
459     std::string videoId = "testVideoId";
460     sptr<IPCFileDescriptor> ipcFileDescriptor;
461     int32_t ret = 0;
462     ret = remoteCallback->OnProcessVideoDone(videoId, ipcFileDescriptor);
463     EXPECT_EQ(ret, 0);
464 
465     int32_t errorCode = 0;
466     ret = remoteCallback->OnError(videoId, errorCode);
467     EXPECT_EQ(ret, 0);
468 
469     int32_t status = 0;
470     ret = remoteCallback->OnStateChanged(status);
471     EXPECT_EQ(ret, 0);
472 }
473 
474 /*
475  * Feature: Framework
476  * Function: When the test does not implement the callback, the function call is normal.
477  * SubFunction: NA
478  * FunctionPoints: NA
479  * EnvConditions: NA
480  * CaseDescription: When the test does not implement the callback, the function call is normal.
481  */
482 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_011, TestSize.Level0)
483 {
484     sptr<DeferredVideoProcSession> deferredProcSession = new(std::nothrow) DeferredVideoProcSession(userId_, nullptr);
485     ASSERT_NE(deferredProcSession, nullptr);
486 
487     sptr<DeferredVideoProcessingSessionCallback> remoteCallback =
488         new(std::nothrow) DeferredVideoProcessingSessionCallback(deferredProcSession);
489     ASSERT_NE(remoteCallback, nullptr);
490     std::string videoId = "testVideoId";
491     sptr<IPCFileDescriptor> ipcFileDescriptor;
492     int32_t ret = 0;
493     ret = remoteCallback->OnProcessVideoDone(videoId, ipcFileDescriptor);
494     EXPECT_EQ(ret, 0);
495 
496     int32_t errorCode = 0;
497     ret = remoteCallback->OnError(videoId, errorCode);
498     EXPECT_EQ(ret, 0);
499 
500     int32_t status = 0;
501     ret = remoteCallback->OnStateChanged(status);
502     EXPECT_EQ(ret, 0);
503 }
504 
505 /*
506  * Feature: Framework
507  * Function: The test function is returned abnormally.
508  * SubFunction: NA
509  * FunctionPoints: NA
510  * EnvConditions: NA
511  * CaseDescription: The test function is returned abnormally.
512  */
513 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_012, TestSize.Level0)
514 {
515     sptr<DeferredVideoProcSession> deferredProcSession = new(std::nothrow) DeferredVideoProcSession(userId_, nullptr);
516     ASSERT_NE(deferredProcSession, nullptr);
517 
518     sptr<DeferredVideoProcessingSessionCallback> remoteCallback =
519         new(std::nothrow) DeferredVideoProcessingSessionCallback();
520     ASSERT_NE(remoteCallback, nullptr);
521     std::string videoId = "testVideoId";
522     sptr<IPCFileDescriptor> ipcFileDescriptor;
523     int32_t ret = 0;
524     ret = remoteCallback->OnProcessVideoDone(videoId, ipcFileDescriptor);
525     EXPECT_EQ(ret, 0);
526 
527     int32_t errorCode = 0;
528     ret = remoteCallback->OnError(videoId, errorCode);
529     EXPECT_EQ(ret, 0);
530 
531     int32_t status = 0;
532     ret = remoteCallback->OnStateChanged(status);
533     EXPECT_EQ(ret, 0);
534 }
535 
536 /*
537  * Feature: Framework
538  * Function: Test DeferredPhotoProcessingSessionCallback
539  * SubFunction: NA
540  * FunctionPoints: NA
541  * EnvConditions: NA
542  * CaseDescription: Test DeferredPhotoProcessingSessionCallback
543  */
544 HWTEST_F(DeferredProcUnitTest, camera_deferred_proc_unittest_013, TestSize.Level0)
545 {
546     std::shared_ptr<DeferredPhotoProcessingSessionCallback> deferredPhotoSessionCb1 =
547         std::make_shared<DeferredPhotoProcessingSessionCallback>();
548     ASSERT_NE(deferredPhotoSessionCb1, nullptr);
549     sptr<DeferredPhotoProcSession> deferredProcSession =
550         new(std::nothrow) DeferredPhotoProcSession(userId_, std::make_shared<TestDeferredPhotoProcSessionCallback>());
551     ASSERT_NE(deferredProcSession, nullptr);
552     std::shared_ptr<DeferredPhotoProcessingSessionCallback> deferredPhotoSessionCb2 =
553         std::make_shared<DeferredPhotoProcessingSessionCallback>(deferredProcSession);
554     ASSERT_NE(deferredPhotoSessionCb2, nullptr);
555 }
556 } // CameraStandard
557 } // OHOS
558