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 <gtest/gtest.h>
17 #include <fstream>
18 #include "avsession_descriptor.h"
19 #include "avsession_log.h"
20 #include "avsession_errors.h"
21 #include "avsession_service.h"
22 #include "system_ability_definition.h"
23
24 using namespace testing::ext;
25
26 namespace OHOS::AVSession {
27 static char g_testSessionTag[] = "test";
28 static char g_testAnotherBundleName[] = "testAnother.ohos.avsession";
29 static char g_testAnotherAbilityName[] = "testAnother.ability";
30 static std::shared_ptr<AVSessionService> g_AVSessionService;
31
32 class AVSessionServiceSupplementTest : public testing::Test {
33 public:
34 static void SetUpTestCase();
35 static void TearDownTestCase();
36 void SetUp() override;
37 void TearDown() override;
38 };
39
SetUpTestCase()40 void AVSessionServiceSupplementTest::SetUpTestCase()
41 {
42 SLOGI("set up AVSessionServiceTest");
43 system("killall -9 com.example.hiMusicDemo");
44 g_AVSessionService = std::make_shared<AVSessionService>(OHOS::AVSESSION_SERVICE_ID);
45 }
46
TearDownTestCase()47 void AVSessionServiceSupplementTest::TearDownTestCase()
48 {
49 }
50
SetUp()51 void AVSessionServiceSupplementTest::SetUp()
52 {
53 }
54
TearDown()55 void AVSessionServiceSupplementTest::TearDown()
56 {
57 }
58
59 /**
60 * @tc.name: GetService001
61 * @tc.desc: Test GetService
62 * @tc.type: FUNC
63 */
HWTEST_F(AVSessionServiceSupplementTest, GetService001, TestSize.Level1)64 static HWTEST_F(AVSessionServiceSupplementTest, GetService001, TestSize.Level1)
65 {
66 SLOGI("GetService001 begin!");
67 std::string id = "";
68 auto ret = g_AVSessionService->GetService(id);
69 EXPECT_NE(ret, nullptr);
70 SLOGI("GetService001 end!");
71 }
72
73 /**
74 * @tc.name: IsLocalDevice001
75 * @tc.desc: Test IsLocalDevice
76 * @tc.type: FUNC
77 */
HWTEST_F(AVSessionServiceSupplementTest, IsLocalDevice001, TestSize.Level1)78 static HWTEST_F(AVSessionServiceSupplementTest, IsLocalDevice001, TestSize.Level1)
79 {
80 SLOGI("IsLocalDevice001 begin!");
81 std::string id;
82 int32_t getSuccess = g_AVSessionService->GetLocalNetworkId(id);
83 EXPECT_NE(getSuccess, AVSESSION_SUCCESS);
84 bool ret = g_AVSessionService->IsLocalDevice(id);
85 EXPECT_EQ(ret, true);
86 SLOGI("IsLocalDevice001 end!");
87 }
88
89 /**
90 * @tc.name: GetTrustedDeviceName001
91 * @tc.desc: Test GetTrustedDeviceName
92 * @tc.type: FUNC
93 */
HWTEST_F(AVSessionServiceSupplementTest, GetTrustedDeviceName001, TestSize.Level1)94 static HWTEST_F(AVSessionServiceSupplementTest, GetTrustedDeviceName001, TestSize.Level1)
95 {
96 SLOGI("GetTrustedDeviceName001 begin!");
97 std::string networkId = "";
98 std::string deviceName = "";
99 int32_t ret = g_AVSessionService->GetTrustedDeviceName(networkId, deviceName);
100 EXPECT_EQ(ret, AVSESSION_SUCCESS);
101 SLOGI("GetTrustedDeviceName001 end!");
102 }
103
104 /**
105 * @tc.name: SetDeviceInfo001
106 * @tc.desc: Test SetDeviceInfo
107 * @tc.type: FUNC
108 */
HWTEST_F(AVSessionServiceSupplementTest, SetDeviceInfo001, TestSize.Level1)109 static HWTEST_F(AVSessionServiceSupplementTest, SetDeviceInfo001, TestSize.Level1)
110 {
111 SLOGI("SetDeviceInfo001 begin!");
112 AudioStandard::AudioDeviceDescriptor descriptor;
113 std::vector<AudioStandard::AudioDeviceDescriptor> castAudioDescriptors;
114 castAudioDescriptors.push_back(descriptor);
115
116 OHOS::AppExecFwk::ElementName elementName;
117 elementName.SetBundleName(g_testAnotherBundleName);
118 elementName.SetAbilityName(g_testAnotherAbilityName);
119 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
120 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
121
122 EXPECT_NE(avsessionItem, nullptr);
123
124 g_AVSessionService->SetDeviceInfo(castAudioDescriptors, avsessionItem);
125 avsessionItem->Destroy();
126 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
127 SLOGI("SetDeviceInfo001 end!");
128 }
129
130 /**
131 * @tc.name: GetAudioDescriptorByDeviceId001
132 * @tc.desc: Test GetAudioDescriptorByDeviceId
133 * @tc.type: FUNC
134 */
HWTEST_F(AVSessionServiceSupplementTest, GetAudioDescriptorByDeviceId001, TestSize.Level1)135 static HWTEST_F(AVSessionServiceSupplementTest, GetAudioDescriptorByDeviceId001, TestSize.Level1)
136 {
137 SLOGI("GetAudioDescriptorByDeviceId001 begin!");
138 std::vector<sptr<AudioStandard::AudioDeviceDescriptor>> descriptors;
139 sptr<AudioStandard::AudioDeviceDescriptor> descriptor = new AudioStandard::AudioDeviceDescriptor();
140 descriptors.push_back(descriptor);
141 std::string deviceId = "0";
142 AudioStandard::AudioDeviceDescriptor audioDescriptor;
143 bool ret = g_AVSessionService->GetAudioDescriptorByDeviceId(descriptors, deviceId, audioDescriptor);
144 EXPECT_EQ(ret, true);
145 SLOGI("GetAudioDescriptorByDeviceId001 end!");
146 }
147
148 /**
149 * @tc.name: GetAudioDescriptorByDeviceId002
150 * @tc.desc: Test GetAudioDescriptorByDeviceId
151 * @tc.type: FUNC
152 */
HWTEST_F(AVSessionServiceSupplementTest, GetAudioDescriptorByDeviceId002, TestSize.Level1)153 static HWTEST_F(AVSessionServiceSupplementTest, GetAudioDescriptorByDeviceId002, TestSize.Level1)
154 {
155 SLOGI("GetAudioDescriptorByDeviceId002 begin!");
156 std::vector<sptr<AudioStandard::AudioDeviceDescriptor>> descriptors;
157 sptr<AudioStandard::AudioDeviceDescriptor> descriptor = new AudioStandard::AudioDeviceDescriptor();
158 descriptors.push_back(descriptor);
159 std::string deviceId = "1";
160 AudioStandard::AudioDeviceDescriptor audioDescriptor;
161 bool ret = g_AVSessionService->GetAudioDescriptorByDeviceId(descriptors, deviceId, audioDescriptor);
162 EXPECT_EQ(ret, false);
163 SLOGI("GetAudioDescriptorByDeviceId002 end!");
164 }
165
166 /**
167 * @tc.name: GetDeviceInfo001
168 * @tc.desc: Test GetDeviceInfo
169 * @tc.type: FUNC
170 */
HWTEST_F(AVSessionServiceSupplementTest, GetDeviceInfo001, TestSize.Level1)171 static HWTEST_F(AVSessionServiceSupplementTest, GetDeviceInfo001, TestSize.Level1)
172 {
173 SLOGI("GetDeviceInfo001 begin!");
174 OHOS::AppExecFwk::ElementName elementName;
175 elementName.SetBundleName(g_testAnotherBundleName);
176 elementName.SetAbilityName(g_testAnotherAbilityName);
177 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
178 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
179
180 std::vector<AudioStandard::AudioDeviceDescriptor> castSinkDescriptors;
181 std::vector<AudioStandard::AudioDeviceDescriptor> cancelSinkDescriptors;
182 std::vector<AudioStandard::AudioDeviceDescriptor> descriptors;
183 AudioStandard::AudioDeviceDescriptor descriptor;
184 descriptors.push_back(descriptor);
185
186 g_AVSessionService->GetDeviceInfo(avsessionItem,
187 descriptors, castSinkDescriptors, cancelSinkDescriptors);
188 EXPECT_EQ(castSinkDescriptors.size(), descriptors.size());
189 avsessionItem->Destroy();
190 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
191 SLOGI("GetDeviceInfo001 end!");
192 }
193
194 /**
195 * @tc.name: GetDeviceInfo002
196 * @tc.desc: Test GetDeviceInfo
197 * @tc.type: FUNC
198 */
HWTEST_F(AVSessionServiceSupplementTest, GetDeviceInfo002, TestSize.Level1)199 static HWTEST_F(AVSessionServiceSupplementTest, GetDeviceInfo002, TestSize.Level1)
200 {
201 SLOGI("GetDeviceInfo002 begin!");
202 OHOS::AppExecFwk::ElementName elementName;
203 elementName.SetBundleName(g_testAnotherBundleName);
204 elementName.SetAbilityName(g_testAnotherAbilityName);
205 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
206 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
207
208 std::vector<AudioStandard::AudioDeviceDescriptor> castSinkDescriptors;
209 std::vector<AudioStandard::AudioDeviceDescriptor> cancelSinkDescriptors;
210 std::vector<AudioStandard::AudioDeviceDescriptor> descriptors;
211
212 g_AVSessionService->GetDeviceInfo(avsessionItem,
213 descriptors, castSinkDescriptors, cancelSinkDescriptors);
214 EXPECT_EQ(descriptors.size(), 0);
215 avsessionItem->Destroy();
216 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
217 SLOGI("GetDeviceInfo002 end!");
218 }
219
220 /**
221 * @tc.name: CastAudioProcess001
222 * @tc.desc: Test CastAudioProcess
223 * @tc.type: FUNC
224 */
HWTEST_F(AVSessionServiceSupplementTest, CastAudioProcess001, TestSize.Level1)225 static HWTEST_F(AVSessionServiceSupplementTest, CastAudioProcess001, TestSize.Level1)
226 {
227 SLOGI("CastAudioProcess001 begin!");
228 OHOS::AppExecFwk::ElementName elementName;
229 elementName.SetBundleName(g_testAnotherBundleName);
230 elementName.SetAbilityName(g_testAnotherAbilityName);
231 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
232 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
233
234 std::vector<AudioStandard::AudioDeviceDescriptor> descriptors;
235 AudioStandard::AudioDeviceDescriptor descriptor;
236 descriptors.push_back(descriptor);
237
238 std::string sourceSessionInfo = "";
239 int32_t ret = g_AVSessionService->CastAudioProcess(descriptors,
240 sourceSessionInfo, avsessionItem);
241 EXPECT_EQ(ret, AVSESSION_ERROR);
242 avsessionItem->Destroy();
243 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
244 SLOGI("CastAudioProcess001 end!");
245 }
246
247 /**
248 * @tc.name: CastAudioProcess002
249 * @tc.desc: Test CastAudioProcess
250 * @tc.type: FUNC
251 */
HWTEST_F(AVSessionServiceSupplementTest, CastAudioProcess002, TestSize.Level1)252 static HWTEST_F(AVSessionServiceSupplementTest, CastAudioProcess002, TestSize.Level1)
253 {
254 SLOGI("CastAudioProcess002 begin!");
255 OHOS::AppExecFwk::ElementName elementName;
256 elementName.SetBundleName(g_testAnotherBundleName);
257 elementName.SetAbilityName(g_testAnotherAbilityName);
258 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
259 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
260
261 AudioStandard::AudioDeviceDescriptor descriptor;
262 std::vector<AudioStandard::AudioDeviceDescriptor> setDescriptors;
263 setDescriptors.push_back(descriptor);
264 g_AVSessionService->SetDeviceInfo(setDescriptors, avsessionItem);
265
266 std::string sourceSessionInfo = "";
267 int32_t ret = g_AVSessionService->CastAudioProcess(setDescriptors,
268 sourceSessionInfo, avsessionItem);
269 EXPECT_EQ(ret, AVSESSION_ERROR);
270 avsessionItem->Destroy();
271 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
272 SLOGI("CastAudioProcess002 end!");
273 }
274
275 /**
276 * @tc.name: IsHistoricalSession001
277 * @tc.desc: Test IsHistoricalSession
278 * @tc.type: FUNC
279 */
HWTEST_F(AVSessionServiceSupplementTest, IsHistoricalSession001, TestSize.Level1)280 static HWTEST_F(AVSessionServiceSupplementTest, IsHistoricalSession001, TestSize.Level1)
281 {
282 SLOGI("IsHistoricalSession001 begin!");
283 OHOS::AppExecFwk::ElementName elementName;
284 elementName.SetBundleName(g_testAnotherBundleName);
285 elementName.SetAbilityName(g_testAnotherAbilityName);
286 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
287 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
288
289 std::string id = "*****";
290 std::string filePath = g_AVSessionService->GetAVSortDir();
291 ofstream ofs;
292 ofs.open(filePath, ios::out);
293 ofs << id;
294 ofs.close();
295
296 bool ret = g_AVSessionService->IsHistoricalSession(id);
297 EXPECT_EQ(ret, true);
298 avsessionItem->Destroy();
299 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
300 SLOGI("IsHistoricalSession001 end!");
301 }
302
303 /**
304 * @tc.name: IsHistoricalSession002
305 * @tc.desc: Test IsHistoricalSession
306 * @tc.type: FUNC
307 */
HWTEST_F(AVSessionServiceSupplementTest, IsHistoricalSession002, TestSize.Level1)308 static HWTEST_F(AVSessionServiceSupplementTest, IsHistoricalSession002, TestSize.Level1)
309 {
310 SLOGI("IsHistoricalSession002 begin!");
311 OHOS::AppExecFwk::ElementName elementName;
312 elementName.SetBundleName(g_testAnotherBundleName);
313 elementName.SetAbilityName(g_testAnotherAbilityName);
314 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
315 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
316
317 std::string sessionId = avsessionItem->GetSessionId();
318 std::string filePath = g_AVSessionService->GetAVSortDir();
319 ofstream ofs;
320 ofs.open(filePath, ios::out);
321 ofs << sessionId;
322 ofs.close();
323
324 bool ret = g_AVSessionService->IsHistoricalSession(sessionId);
325 EXPECT_EQ(ret, false);
326 avsessionItem->Destroy();
327 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
328 SLOGI("IsHistoricalSession002 end!");
329 }
330
331 /**
332 * @tc.name: Dump001
333 * @tc.desc: Test Dump
334 * @tc.type: FUNC
335 */
HWTEST_F(AVSessionServiceSupplementTest, Dump001, TestSize.Level1)336 static HWTEST_F(AVSessionServiceSupplementTest, Dump001, TestSize.Level1)
337 {
338 SLOGI("Dump001 begin!");
339 std::vector<std::u16string> argsList;
340 g_AVSessionService->OnStart();
341 int32_t ret = g_AVSessionService->Dump(1, argsList);
342 EXPECT_EQ(ret, ERR_INVALID_PARAM);
343 SLOGI("Dump001 end!");
344 }
345
346 /**
347 * @tc.name: Dump002
348 * @tc.desc: Test Dump
349 * @tc.type: FUNC
350 */
HWTEST_F(AVSessionServiceSupplementTest, Dump002, TestSize.Level1)351 static HWTEST_F(AVSessionServiceSupplementTest, Dump002, TestSize.Level1)
352 {
353 SLOGI("Dump002 begin!");
354 std::vector<std::u16string> argsList;
355 std::u16string str(5, 'a');
356 argsList.emplace_back(str);
357 g_AVSessionService->OnStart();
358 int32_t ret = g_AVSessionService->Dump(1, argsList);
359 EXPECT_EQ(ret, ERR_INVALID_PARAM);
360 SLOGI("Dump002 end!");
361 }
362
363 /**
364 * @tc.name: SaveStringToFileEx001
365 * @tc.desc: Test SaveStringToFile
366 * @tc.type: FUNC
367 */
HWTEST_F(AVSessionServiceSupplementTest, SaveStringToFileEx001, TestSize.Level1)368 static HWTEST_F(AVSessionServiceSupplementTest, SaveStringToFileEx001, TestSize.Level1)
369 {
370 SLOGI("SaveStringToFileEx001 begin!");
371 OHOS::AppExecFwk::ElementName elementName;
372 elementName.SetBundleName(g_testAnotherBundleName);
373 elementName.SetAbilityName(g_testAnotherAbilityName);
374 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
375 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
376
377 std::string filePath = "/adcdXYZ123/test5.txt";
378 std::string content;
379 ifstream file(filePath, ios_base::in);
380 bool ret = g_AVSessionService->SaveStringToFileEx(filePath, content);
381 file.close();
382 EXPECT_EQ(ret, false);
383 avsessionItem->Destroy();
384 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
385 SLOGI("SaveStringToFileEx001 end!");
386 }
387
388 /**
389 * @tc.name: SaveStringToFileEx002
390 * @tc.desc: Test SaveStringToFile
391 * @tc.type: FUNC
392 */
HWTEST_F(AVSessionServiceSupplementTest, SaveStringToFileEx002, TestSize.Level1)393 static HWTEST_F(AVSessionServiceSupplementTest, SaveStringToFileEx002, TestSize.Level1)
394 {
395 SLOGI("SaveStringToFileEx002 begin!");
396 OHOS::AppExecFwk::ElementName elementName;
397 elementName.SetBundleName(g_testAnotherBundleName);
398 elementName.SetAbilityName(g_testAnotherAbilityName);
399 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
400 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
401
402 std::string filePath = g_AVSessionService->GetAVSortDir();
403 std::string content;
404 bool ret = g_AVSessionService->SaveStringToFileEx(filePath, content);
405 EXPECT_EQ(ret, false);
406 avsessionItem->Destroy();
407 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
408 SLOGI("SaveStringToFileEx002 end!");
409 }
410
411 /**
412 * @tc.name: SaveStringToFileEx003
413 * @tc.desc: Test SaveStringToFile
414 * @tc.type: FUNC
415 */
HWTEST_F(AVSessionServiceSupplementTest, SaveStringToFileEx003, TestSize.Level1)416 static HWTEST_F(AVSessionServiceSupplementTest, SaveStringToFileEx003, TestSize.Level1)
417 {
418 SLOGI("SaveStringToFileEx003 begin!");
419 OHOS::AppExecFwk::ElementName elementName;
420 elementName.SetBundleName(g_testAnotherBundleName);
421 elementName.SetAbilityName(g_testAnotherAbilityName);
422 sptr<AVSessionItem> avsessionItem = g_AVSessionService->CreateSessionInner(
423 g_testSessionTag, AVSession::SESSION_TYPE_AUDIO, false, elementName);
424
425 std::string filePath = g_AVSessionService->GetAVSortDir();
426 std::string content = "123456";
427 bool ret = g_AVSessionService->SaveStringToFileEx(filePath, content);
428 EXPECT_EQ(ret, true);
429 avsessionItem->Destroy();
430 g_AVSessionService->HandleSessionRelease(avsessionItem->GetSessionId());
431 SLOGI("SaveStringToFileEx003 end!");
432 }
433
434 #ifdef CASTPLUS_CAST_ENGINE_ENABLE
435 /**
436 * @tc.name: SuperLauncher001
437 * @tc.desc: Test SuperLauncher
438 * @tc.type: FUNC
439 */
HWTEST_F(AVSessionServiceSupplementTest, SuperLauncher001, TestSize.Level1)440 static HWTEST_F(AVSessionServiceSupplementTest, SuperLauncher001, TestSize.Level1)
441 {
442 SLOGI("SuperLauncher001 begin!");
443 std::string devideId = "***";
444 std::string extraInfo = "*,**";
445 std::vector< std::string > serviceNames = {"HuaweiCast", "HuaweiCast-Dual"};
446 std::vector< std::string > states = {"IDLE", "CONNECT_SUCC"};
447 for (std::string serviceName : serviceNames) {
448 for (std::string state : states) {
449 g_AVSessionService->SuperLauncher(devideId, serviceName, extraInfo, state);
450 }
451 }
452
453 EXPECT_EQ(serviceNames.size(), 2);
454 SLOGI("SuperLauncher001 end!");
455 }
456
457 /**
458 * @tc.name: SuperLauncher002
459 * @tc.desc: Test SuperLauncher
460 * @tc.type: FUNC
461 */
HWTEST_F(AVSessionServiceSupplementTest, SuperLauncher002, TestSize.Level1)462 static HWTEST_F(AVSessionServiceSupplementTest, SuperLauncher002, TestSize.Level1)
463 {
464 SLOGI("SuperLauncher002 begin!");
465 std::string devideId = "***";
466 std::string extraInfo = "***";
467 std::string serviceName = "***";
468 std::string state = "***";
469 g_AVSessionService->SuperLauncher(devideId, serviceName, extraInfo, state);
470 EXPECT_EQ(serviceName, "***");
471 SLOGI("SuperLauncher002 end!");
472 }
473
474 /**
475 * @tc.name: SplitExtraInfo001
476 * @tc.desc: Test SplitExtraInfo
477 * @tc.type: FUNC
478 */
HWTEST_F(AVSessionServiceSupplementTest, SplitExtraInfo001, TestSize.Level1)479 static HWTEST_F(AVSessionServiceSupplementTest, SplitExtraInfo001, TestSize.Level1)
480 {
481 SLOGI("SplitExtraInfo001 begin!");
482 std::string info = R"(
483 {SUPPORT_MIRROR_TO_STREAM: true},
484 {deviceId: ***},
485 {deviceName: ***},
486 {deviceType: ***}
487 )";
488 g_AVSessionService->SplitExtraInfo(info);
489 EXPECT_NE(info.size(), 0);
490 SLOGI("SplitExtraInfo001 end!");
491 }
492
493 /**
494 * @tc.name: SplitExtraInfo002
495 * @tc.desc: Test SplitExtraInfo
496 * @tc.type: FUNC
497 */
HWTEST_F(AVSessionServiceSupplementTest, SplitExtraInfo002, TestSize.Level1)498 static HWTEST_F(AVSessionServiceSupplementTest, SplitExtraInfo002, TestSize.Level1)
499 {
500 SLOGI("SplitExtraInfo002 begin!");
501 std::string info = R"(
502 {SUPPORT_MIRROR_TO_STREAM, false},
503 {deviceId, ***},
504 {deviceName, ***},
505 {deviceType, ***}
506 )";
507 g_AVSessionService->SplitExtraInfo(info);
508 EXPECT_NE(info.size(), 0);
509 SLOGI("SplitExtraInfo002 end!");
510 }
511
512 /**
513 * @tc.name: SplitExtraInfo003
514 * @tc.desc: Test SplitExtraInfo
515 * @tc.type: FUNC
516 */
HWTEST_F(AVSessionServiceSupplementTest, SplitExtraInfo003, TestSize.Level1)517 static HWTEST_F(AVSessionServiceSupplementTest, SplitExtraInfo003, TestSize.Level1)
518 {
519 SLOGI("SplitExtraInfo003 begin!");
520 std::string info = "";
521 g_AVSessionService->SplitExtraInfo(info);
522 EXPECT_EQ(info.size(), 0);
523 SLOGI("SplitExtraInfo003 end!");
524 }
525
526 #endif
527 } // OHOS::AVSession