• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 "screen_data_channel_impl_test.h"
17 #include "dscreen_json_util.h"
18 #include "dscreen_util.h"
19 #include "screen_source_trans.h"
20 #include "softbus_adapter.h"
21 #include "token_setproc.h"
22 
23 static int32_t g_mockCreateSoftbusSessionServerReturnInt32Value = -1;
24 static int32_t g_mockOpenSoftbusSessionReturnInt32Value = -1;
25 static int32_t g_mockRegisterSoftbusListenerReturnInt32Value = -1;
26 static int32_t g_mockRemoveSoftbusSessionServerReturnInt32Value = -1;
27 static int32_t g_mockUnRegisterSoftbusListenerReturnInt32Value = -1;
28 static int32_t g_mockCloseSoftbusSessionReturnInt32Value = -1;
29 
30 using namespace testing;
31 using namespace testing::ext;
32 
33 namespace OHOS {
34 namespace DistributedHardware {
35 namespace {
36     const std::string PEER_SESSION_NAME = "ohos.dhardware.dscreen.session8647073e02e7a78f09473aa123";
37     const std::string REMOTE_DEV_ID = "f6d4c0864707aefte7a78f09473aa122ff57fc81c00981fcf5be989e7d112123";
38     const std::string DSCREEN_PKG_NAME_TEST = "ohos.dhardware.dscreen";
39 }
CreateSoftbusSessionServer(const std::string & pkgname,const std::string & sessionName,const std::string & peerDevId)40 int32_t SoftbusAdapter::CreateSoftbusSessionServer(const std::string &pkgname, const std::string &sessionName,
41     const std::string &peerDevId)
42 {
43     return g_mockCreateSoftbusSessionServerReturnInt32Value;
44 }
45 
RemoveSoftbusSessionServer(const std::string & pkgname,const std::string & sessionName,const std::string & peerDevId)46 int32_t SoftbusAdapter::RemoveSoftbusSessionServer(const std::string &pkgname, const std::string &sessionName,
47     const std::string &peerDevId)
48 {
49     return g_mockRemoveSoftbusSessionServerReturnInt32Value;
50 }
51 
RegisterSoftbusListener(const std::shared_ptr<ISoftbusListener> & listener,const std::string & sessionName,const std::string & peerDevId)52 int32_t SoftbusAdapter::RegisterSoftbusListener(const std::shared_ptr<ISoftbusListener> &listener,
53     const std::string &sessionName, const std::string &peerDevId)
54 {
55     return g_mockRegisterSoftbusListenerReturnInt32Value;
56 }
57 
UnRegisterSoftbusListener(const std::string & sessionName,const std::string & peerDevId)58 int32_t SoftbusAdapter::UnRegisterSoftbusListener(const std::string &sessionName, const std::string &peerDevId)
59 {
60     return g_mockUnRegisterSoftbusListenerReturnInt32Value;
61 }
62 
OpenSoftbusSession(const std::string & mySessionName,const std::string & peerSessionName,const std::string & peerDevId)63 int32_t SoftbusAdapter::OpenSoftbusSession(const std::string &mySessionName, const std::string &peerSessionName,
64     const std::string &peerDevId)
65 {
66     return g_mockOpenSoftbusSessionReturnInt32Value;
67 }
68 
CloseSoftbusSession(const int32_t sessionId)69 int32_t SoftbusAdapter::CloseSoftbusSession(const int32_t sessionId)
70 {
71     return g_mockCloseSoftbusSessionReturnInt32Value;
72 }
73 
SetUpTestCase(void)74 void ScreenDataChannelImplTest::SetUpTestCase(void) {}
75 
TearDownTestCase(void)76 void ScreenDataChannelImplTest::TearDownTestCase(void) {}
77 
SetUp(void)78 void ScreenDataChannelImplTest::SetUp(void)
79 {
80     g_mockRegisterSoftbusListenerReturnInt32Value = -1;
81     g_mockCreateSoftbusSessionServerReturnInt32Value = -1;
82     g_mockRemoveSoftbusSessionServerReturnInt32Value = -1;
83     g_mockUnRegisterSoftbusListenerReturnInt32Value = -1;
84     g_mockOpenSoftbusSessionReturnInt32Value = -1;
85     g_mockCloseSoftbusSessionReturnInt32Value = -1;
86     std::string peerDevId = "test";
87     dataChannelImpl_ = std::make_shared<ScreenDataChannelImpl>(peerDevId);
88 }
89 
TearDown(void)90 void ScreenDataChannelImplTest::TearDown(void)
91 {
92     if (dataChannelImpl_ != nullptr) {
93         dataChannelImpl_->CloseSession();
94         dataChannelImpl_->ReleaseSession();
95         dataChannelImpl_ = nullptr;
96     }
97 }
98 
99 /**
100  * @tc.name: CreateSession_001
101  * @tc.desc: Verify the CreateSession function.
102  * @tc.type: FUNC
103  * @tc.require: Issue Number
104  */
105 HWTEST_F(ScreenDataChannelImplTest, CreateSession_001, TestSize.Level1)
106 {
107     std::shared_ptr<IScreenChannelListener> listener = nullptr;
108     int32_t ret = dataChannelImpl_->CreateSession(listener);
109 
110     EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, ret);
111 }
112 
113 /**
114  * @tc.name: CreateSession_002
115  * @tc.desc: Verify the CreateSession function.
116  * @tc.type: FUNC
117  * @tc.require: Issue Number
118  */
119 HWTEST_F(ScreenDataChannelImplTest, CreateSession_002, TestSize.Level1)
120 {
121     g_mockCreateSoftbusSessionServerReturnInt32Value = DH_SUCCESS;
122     g_mockRegisterSoftbusListenerReturnInt32Value = DH_SUCCESS;
123     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<MockIScreenChannelListener>();
124     dataChannelImpl_->jpegSessionFlag_ = false;
125     int32_t ret = dataChannelImpl_->CreateSession(listener);
126     EXPECT_EQ(DH_SUCCESS, ret);
127 
128     dataChannelImpl_->jpegSessionFlag_ = true;
129     ret = dataChannelImpl_->CreateSession(listener);
130     EXPECT_EQ(DH_SUCCESS, ret);
131 }
132 
133 /**
134  * @tc.name: CreateSession_003
135  * @tc.desc: Verify the CreateSession function.
136  * @tc.type: FUNC
137  * @tc.require: Issue Number
138  */
139 HWTEST_F(ScreenDataChannelImplTest, CreateSession_003, TestSize.Level1)
140 {
141     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<MockIScreenChannelListener>();
142     int32_t ret = dataChannelImpl_->CreateSession(listener);
143     EXPECT_NE(DH_SUCCESS, ret);
144 
145     g_mockCreateSoftbusSessionServerReturnInt32Value = DH_SUCCESS;
146     ret = dataChannelImpl_->CreateSession(listener);
147     EXPECT_NE(DH_SUCCESS, ret);
148 }
149 
150 /**
151  * @tc.name: OpenSession_001
152  * @tc.desc: Verify the OpenSession function.
153  * @tc.type: FUNC
154  * @tc.require: Issue Number
155  */
156 HWTEST_F(ScreenDataChannelImplTest, OpenSession_001, TestSize.Level1)
157 {
158     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<MockIScreenChannelListener>();
159     int32_t ret = dataChannelImpl_->OpenSession(listener);
160     EXPECT_NE(DH_SUCCESS, ret);
161 
162     g_mockRegisterSoftbusListenerReturnInt32Value = DH_SUCCESS;
163     ret = dataChannelImpl_->OpenSession(listener);
164     EXPECT_NE(DH_SUCCESS, ret);
165 
166     g_mockOpenSoftbusSessionReturnInt32Value = DH_SUCCESS;
167     dataChannelImpl_->jpegSessionFlag_ = true;
168     ret = dataChannelImpl_->OpenSession(listener);
169     EXPECT_EQ(DH_SUCCESS, ret);
170 
171     dataChannelImpl_->jpegSessionFlag_ = false;
172     ret = dataChannelImpl_->OpenSession(listener);
173     EXPECT_EQ(DH_SUCCESS, ret);
174 }
175 
176 /**
177  * @tc.name: OpenSession_002
178  * @tc.desc: Verify the OpenSession function.
179  * @tc.type: FUNC
180  * @tc.require: Issue Number
181  */
182 HWTEST_F(ScreenDataChannelImplTest, OpenSession_002, TestSize.Level1)
183 {
184     int32_t ret = dataChannelImpl_->OpenSession(nullptr);
185     EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, ret);
186 }
187 
188 /**
189  * @tc.name: SendFullData_001
190  * @tc.desc: Verify the SendFullData function.
191  * @tc.type: FUNC
192  * @tc.require: Issue Number
193  */
194 HWTEST_F(ScreenDataChannelImplTest, SendFullData_001, TestSize.Level1)
195 {
196     std::shared_ptr<DataBuffer> screenData = nullptr;
197     int32_t ret = dataChannelImpl_->SendFullData(screenData);
198     EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, ret);
199 }
200 
201 /**
202  * @tc.name: SendFullData_002
203  * @tc.desc: Verify the SendFullData function.
204  * @tc.type: FUNC
205  * @tc.require: Issue Number
206  */
207 HWTEST_F(ScreenDataChannelImplTest, SendFullData_002, TestSize.Level1)
208 {
209     std::shared_ptr<DataBuffer> data = std::make_shared<DataBuffer>(10);
210     dataChannelImpl_->sessionId_ = 1;
211     int32_t ret = dataChannelImpl_->SendFullData(data);
212     EXPECT_EQ(ERR_DH_SCREEN_TRANS_ERROR, ret);
213 }
214 
215 /**
216  * @tc.name: SendDirtyData_001
217  * @tc.desc: Verify the SendDirtyData function.
218  * @tc.type: FUNC
219  * @tc.require: Issue Number
220  */
221 HWTEST_F(ScreenDataChannelImplTest, SendDirtyData_001, TestSize.Level1)
222 {
223     std::shared_ptr<DataBuffer> screenData = nullptr;
224     int32_t ret = dataChannelImpl_->SendDirtyData(screenData);
225     EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, ret);
226 }
227 
228 /**
229  * @tc.name: SendDirtyData_002
230  * @tc.desc: Verify the SendDirtyData function.
231  * @tc.type: FUNC
232  * @tc.require: Issue Number
233  */
234 HWTEST_F(ScreenDataChannelImplTest, SendDirtyData_002, TestSize.Level1)
235 {
236     std::shared_ptr<DataBuffer> data = std::make_shared<DataBuffer>(10);
237     dataChannelImpl_->jpegSessionId_ = 1;
238     int32_t ret = dataChannelImpl_->SendFullData(data);
239     EXPECT_EQ(ERR_DH_SCREEN_TRANS_ERROR, ret);
240 }
241 
242 /**
243  * @tc.name: release_session_test_001
244  * @tc.desc: Verify the ReleaseSession function.
245  * @tc.type: FUNC
246  * @tc.require: Issue Number
247  */
248 HWTEST_F(ScreenDataChannelImplTest, release_session_test_001, TestSize.Level1)
249 {
250     g_mockRemoveSoftbusSessionServerReturnInt32Value = DH_SUCCESS;
251     g_mockUnRegisterSoftbusListenerReturnInt32Value = DH_SUCCESS;
252     dataChannelImpl_->jpegSessionFlag_ = false;
253     EXPECT_EQ(DH_SUCCESS, dataChannelImpl_->ReleaseSession());
254 
255     dataChannelImpl_->jpegSessionFlag_ = true;
256     EXPECT_EQ(DH_SUCCESS, dataChannelImpl_->ReleaseSession());
257 
258     g_mockUnRegisterSoftbusListenerReturnInt32Value = -1;
259     EXPECT_NE(DH_SUCCESS, dataChannelImpl_->ReleaseSession());
260 }
261 
262 /**
263  * @tc.name: close_session_test_001
264  * @tc.desc: Verify the CloseSession function.
265  * @tc.type: FUNC
266  * @tc.require: Issue Number
267  */
268 HWTEST_F(ScreenDataChannelImplTest, close_session_test_001, TestSize.Level1)
269 {
270     dataChannelImpl_->sessionId_ = 0;
271     EXPECT_EQ(ERR_DH_SCREEN_TRANS_SESSION_NOT_OPEN, dataChannelImpl_->CloseSession());
272 
273     dataChannelImpl_->sessionId_ = 1;
274     dataChannelImpl_->jpegSessionFlag_ = true;
275     dataChannelImpl_->jpegSessionId_ = 1;
276     g_mockCloseSoftbusSessionReturnInt32Value = DH_SUCCESS;
277     EXPECT_EQ(DH_SUCCESS, dataChannelImpl_->CloseSession());
278 
279     dataChannelImpl_->sessionId_ = 1;
280     dataChannelImpl_->jpegSessionId_ = 0;
281     EXPECT_EQ(DH_SUCCESS, dataChannelImpl_->CloseSession());
282 
283     dataChannelImpl_->sessionId_ = 1;
284     dataChannelImpl_->jpegSessionFlag_ = false;
285     EXPECT_EQ(DH_SUCCESS, dataChannelImpl_->CloseSession());
286 
287     dataChannelImpl_->sessionId_ = 1;
288     g_mockCloseSoftbusSessionReturnInt32Value = -1;
289     EXPECT_NE(DH_SUCCESS, dataChannelImpl_->CloseSession());
290 }
291 
292 /**
293  * @tc.name: close_session_test_002
294  * @tc.desc: Verify the CloseSession function.
295  * @tc.type: FUNC
296  * @tc.require: Issue Number
297  */
298 HWTEST_F(ScreenDataChannelImplTest, close_session_test_002, TestSize.Level1)
299 {
300     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<ScreenSourceTrans>();
301     dataChannelImpl_->channelListener_ = listener;
302     StreamData ext = {0};
303     StreamFrameInfo *param = nullptr;
304 
305     int32_t sessionId = 0;
306     StreamData data;
307     data.buf = new char[DATA_LEN];
308     data.bufLen = DATA_LEN;
309 
310     dataChannelImpl_->OnStreamReceived(sessionId, &data, &ext, param);
311     delete[] data.buf;
312     dataChannelImpl_->sessionId_ = 0;
313     EXPECT_EQ(ERR_DH_SCREEN_TRANS_SESSION_NOT_OPEN, dataChannelImpl_->CloseSession());
314 }
315 
316 /**
317  * @tc.name: send_data_test_001
318  * @tc.desc: Verify the SendData function.
319  * @tc.type: FUNC
320  * @tc.require: Issue Number
321  */
322 HWTEST_F(ScreenDataChannelImplTest, send_data_test_001, TestSize.Level1)
323 {
324     std::shared_ptr<IScreenChannelListener> listener = nullptr;
325     dataChannelImpl_->channelListener_ = listener;
326     int32_t sessionId = 0;
327     PeerSocketInfo peerSocketInfo = {
328         .name = const_cast<char*>(PEER_SESSION_NAME.c_str()),
329         .networkId = const_cast<char*>(REMOTE_DEV_ID.c_str()),
330         .pkgName = const_cast<char*>(DSCREEN_PKG_NAME_TEST.c_str()),
331         .dataType = DATA_TYPE_BYTES
332     };
333     dataChannelImpl_->OnSessionOpened(sessionId, peerSocketInfo);
334     ShutdownReason reason = SHUTDOWN_REASON_UNKNOWN;
335     dataChannelImpl_->OnSessionClosed(sessionId, reason);
336     std::shared_ptr<DataBuffer> data = std::make_shared<DataBuffer>(10);
337     data->SetDataType(VIDEO_PART_SCREEN_DATA);
338     EXPECT_EQ(ERR_DH_SCREEN_TRANS_ERROR, dataChannelImpl_->SendData(data));
339 }
340 
341 /**
342  * @tc.name: send_data_test_002
343  * @tc.desc: Verify the SendData function.
344  * @tc.type: FUNC
345  * @tc.require: Issue Number
346  */
347 HWTEST_F(ScreenDataChannelImplTest, send_data_test_002, TestSize.Level1)
348 {
349     std::shared_ptr<IScreenChannelListener> listener = nullptr;
350     dataChannelImpl_->channelListener_ = listener;
351     std::shared_ptr<DataBuffer> data = nullptr;
352     EXPECT_EQ(ERR_DH_SCREEN_TRANS_NULL_VALUE, dataChannelImpl_->SendData(data));
353 }
354 
355 /**
356  * @tc.name: send_data_test_003
357  * @tc.desc: Verify the SendData function.
358  * @tc.type: FUNC
359  * @tc.require: Issue Number
360  */
361 HWTEST_F(ScreenDataChannelImplTest, send_data_test_003, TestSize.Level1)
362 {
363     std::shared_ptr<IScreenChannelListener> listener = nullptr;
364     dataChannelImpl_->channelListener_ = listener;
365     std::shared_ptr<DataBuffer> data = std::make_shared<DataBuffer>(10);
366     data->SetDataType(VIDEO_FULL_SCREEN_DATA);
367     EXPECT_EQ(ERR_DH_SCREEN_TRANS_ERROR, dataChannelImpl_->SendData(data));
368 }
369 
370 /**
371  * @tc.name: on_session_opened_test_001
372  * @tc.desc: Verify the OnSessionOpened function.
373  * @tc.type: FUNC
374  * @tc.require: Issue Number
375  */
376 HWTEST_F(ScreenDataChannelImplTest, on_session_opened_test_001, TestSize.Level1)
377 {
378     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<ScreenSourceTrans>();
379     dataChannelImpl_->channelListener_ = listener;
380     int32_t sessionId = 1;
381     PeerSocketInfo peerSocketInfo = {
382         .name = const_cast<char*>(PEER_SESSION_NAME.c_str()),
383         .networkId = const_cast<char*>(REMOTE_DEV_ID.c_str()),
384         .pkgName = const_cast<char*>(DSCREEN_PKG_NAME_TEST.c_str()),
385         .dataType = DATA_TYPE_BYTES
386     };
387     dataChannelImpl_->OnSessionOpened(sessionId, peerSocketInfo);
388     EXPECT_EQ(sessionId, dataChannelImpl_->sessionId_);
389 }
390 
391 /**
392  * @tc.name: on_session_opened_test_003
393  * @tc.desc: Verify the OnSessionOpened function.
394  * @tc.type: FUNC
395  * @tc.require: Issue Number
396  */
397 HWTEST_F(ScreenDataChannelImplTest, on_session_opened_test_003, TestSize.Level1)
398 {
399     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<ScreenSourceTrans>();
400     dataChannelImpl_->channelListener_ = listener;
401     int32_t sessionId = 1;
402     dataChannelImpl_->jpegSessionFlag_ = true;
403     dataChannelImpl_->sessionId_ = 1;
404     dataChannelImpl_->jpegSessionId_ = 1;
405     dataChannelImpl_->jpegSessionOpened = false;
406     PeerSocketInfo peerSocketInfo = {
407         .name = const_cast<char*>(PEER_SESSION_NAME.c_str()),
408         .networkId = const_cast<char*>(REMOTE_DEV_ID.c_str()),
409         .pkgName = const_cast<char*>(DSCREEN_PKG_NAME_TEST.c_str()),
410         .dataType = DATA_TYPE_BYTES
411     };
412     dataChannelImpl_->OnSessionOpened(sessionId, peerSocketInfo);
413 
414     dataChannelImpl_->sessionId_ = 2;
415     dataChannelImpl_->dataSessionOpened = false;
416     dataChannelImpl_->OnSessionOpened(sessionId, peerSocketInfo);
417     EXPECT_NE(nullptr, dataChannelImpl_->channelListener_.lock());
418 }
419 
420 /**
421  * @tc.name: JsonToDirtyJson_001
422  * @tc.desc: Verify the JsonToDirtyJson function.
423  * @tc.type: FUNC
424  * @tc.require: Issue Number
425  */
426 HWTEST_F(ScreenDataChannelImplTest, JsonToDirtyJson_001, TestSize.Level1)
427 {
428     std::shared_ptr<DataBuffer> screenData = std::make_shared<DataBuffer>(10);
429     nlohmann::json rectJson;
430     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
431     EXPECT_EQ(0, screenData->DataType());
432     rectJson["dirtySize"] = DIRTY_MAX_SIZE - 1;
433     rectJson["dataType"] = 2;
434     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
435     EXPECT_EQ(0, screenData->DataType());
436     rectJson["3"] = 2;
437     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
438     EXPECT_EQ(0, screenData->DataType());
439     nlohmann::json testJson;
440     rectJson["0"] = testJson;
441     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
442     EXPECT_EQ(0, screenData->DataType());
443     rectJson["0"][KEY_POINT_DIRTY_X] = 100;
444     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
445     EXPECT_EQ(0, screenData->DataType());
446     rectJson["0"][KEY_POINT_DIRTY_Y] = 100;
447     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
448     EXPECT_EQ(0, screenData->DataType());
449     rectJson["0"][KEY_POINT_DIRTY_W] = 100;
450     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
451     EXPECT_EQ(0, screenData->DataType());
452     rectJson["0"][KEY_POINT_DIRTY_H] = 100;
453     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
454     EXPECT_EQ(0, screenData->DataType());
455     rectJson["0"][KEY_POINT_DIRTY_SIZE] = 100;
456     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
457     EXPECT_EQ(0, screenData->DataType());
458     rectJson["dirtySize"] = DIRTY_MAX_SIZE;
459     dataChannelImpl_->JsonToDirtyJson(rectJson, screenData);
460     EXPECT_EQ(0, screenData->DataType());
461 }
462 
463 /**
464  * @tc.name: ProcessDirtyData_001
465  * @tc.desc: Verify the ProcessDirtyData function.
466  * @tc.type: FUNC
467  * @tc.require: Issue Number
468  */
469 HWTEST_F(ScreenDataChannelImplTest, ProcessDirtyData_001, TestSize.Level1)
470 {
471     StreamData data = {0};
472     StreamData ext = {0};
473     std::shared_ptr<DataBuffer> dataBuffer = std::make_shared<DataBuffer>(10);
474     dataChannelImpl_->ProcessDirtyData(&data, dataBuffer, &ext);
475     EXPECT_EQ(0, dataBuffer->DataType());
476 
477     std::shared_ptr<IScreenChannelListener> listener = std::make_shared<ScreenSourceTrans>();
478     dataChannelImpl_->channelListener_ = listener;
479     data.bufLen = dataBuffer->Capacity() + 1;
480     dataChannelImpl_->ProcessDirtyData(&data, dataBuffer, &ext);
481     EXPECT_EQ(0, dataBuffer->DataType());
482 }
483 
484 /**
485  * @tc.name: SetJpegSessionFlag_001
486  * @tc.desc: Verify the SetJpegSessionFlag function.
487  * @tc.type: FUNC
488  * @tc.require: Issue Number
489  */
490 HWTEST_F(ScreenDataChannelImplTest, SetJpegSessionFlag_001, TestSize.Level1)
491 {
492     bool flag = true;
493     dataChannelImpl_->SetJpegSessionFlag(flag);
494     EXPECT_EQ(dataChannelImpl_->jpegSessionFlag_, flag);
495 
496     flag = false;
497     dataChannelImpl_->SetJpegSessionFlag(flag);
498     EXPECT_EQ(dataChannelImpl_->jpegSessionFlag_, flag);
499 }
500 } // DistributedHardware
501 } // OHOS