1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <gmock/gmock.h>
16 #include <gtest/gtest.h>
17 #include "bluetooth_avrcp_ct.h"
18 #include "bluetooth_host.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 using namespace std;
23 
24 namespace OHOS {
25 namespace Bluetooth {
26 class AvrcpControllerObserverCommon : public AvrcpController::IObserver {
27 public:
28     AvrcpControllerObserverCommon() = default;
29     virtual ~AvrcpControllerObserverCommon() = default;
30 
OnConnectionStateChanged(const BluetoothRemoteDevice & device,int state,int cause)31     void OnConnectionStateChanged(const BluetoothRemoteDevice &device, int state, int cause) {}
OnActionCompleted(const BluetoothRemoteDevice & device,const AvrcpCtResponse & resp)32     void OnActionCompleted(const BluetoothRemoteDevice &device, const AvrcpCtResponse &resp){}
33 private:
34 };
35 
36 const uint8_t ATTRIBUTES_TEST = 0x04;
37 const uint32_t ITEMS_ATTRIBUTES_TEST = 1U;
38 static AvrcpControllerObserverCommon observer_;
39 static AvrcpController *profile_;
40 
41 class AvrcpControllerTest : public testing::Test {
42 public:
AvrcpControllerTest()43     AvrcpControllerTest()
44     {}
~AvrcpControllerTest()45     ~AvrcpControllerTest()
46     {}
47 
48     static void SetUpTestCase(void);
49     static void TearDownTestCase(void);
50     void SetUp();
51     void TearDown();
52 
53     BluetoothHost *host_;
54 };
55 
SetUpTestCase(void)56 void AvrcpControllerTest::SetUpTestCase(void)
57 {}
TearDownTestCase(void)58 void AvrcpControllerTest::TearDownTestCase(void)
59 {}
SetUp()60 void AvrcpControllerTest::SetUp()
61 {
62     host_ = &BluetoothHost::GetDefaultHost();
63     host_->EnableBt();
64     host_->EnableBle();
65 
66 }
TearDown()67 void AvrcpControllerTest::TearDown()
68 {
69     host_->DisableBt();
70     host_->DisableBle();
71     host_ = nullptr;
72 }
73 
74 /*
75  * @tc.number: AvrcpController001
76  * @tc.name: GetProfile
77  * @tc.desc: Gets the static instance of the <b>AvrcpController</b> class.
78 */
79 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetProfile, TestSize.Level1)
80 {
81     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetProfile start";
82     profile_ = AvrcpController::GetProfile();
83     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetProfile end";
84 }
85 
86 /*
87  * @tc.number: AvrcpController002
88  * @tc.name: GetConnectedDevices
89  * @tc.desc: Gets the connected devices.
90 */
91 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetConnectedDevices, TestSize.Level1)
92 {
93     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetConnectedDevices start";
94 
95     profile_ = AvrcpController::GetProfile();
96     vector<BluetoothRemoteDevice> devices = profile_->GetConnectedDevices();
97     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetConnectedDevices end";
98 }
99 
100 /*
101  * @tc.number: AvrcpController003
102  * @tc.name: GetDeviceState
103  * @tc.desc: Gets the connection state of the specified bluetooth device.
104 */
105 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetDeviceState, TestSize.Level1)
106 {
107     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetDeviceState start";
108 
109     profile_ = AvrcpController::GetProfile();
110     BluetoothRemoteDevice device;
111     int state = profile_->GetDeviceState(device);
112     EXPECT_EQ(state, 0);
113     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetDeviceState end";
114 }
115 
116 /*
117  * @tc.number: AvrcpController004
118  * @tc.name: RegisterObserver
119  * @tc.desc: Registers the observer.
120 */
121 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_RegisterObserver, TestSize.Level1)
122 {
123     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_RegisterObserver start";
124 
125     profile_ = AvrcpController::GetProfile();
126     profile_->RegisterObserver(&observer_);
127     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_RegisterObserver end";
128 }
129 
130 /*
131  * @tc.number: AvrcpController005
132  * @tc.name: UnregisterObserver
133  * @tc.desc: Unregisters the observer.
134 */
135 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_UnregisterObserver, TestSize.Level1)
136 {
137     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_UnregisterObserver start";
138 
139     profile_ = AvrcpController::GetProfile();
140     profile_->UnregisterObserver(&observer_);
141     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_UnregisterObserver end";
142 }
143 
144 /*
145  * @tc.number: AvrcpController006
146  * @tc.name: GetDevicesByStates
147  * @tc.desc: Gets the devices of the specified states.
148 */
149 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetDevicesByStates, TestSize.Level1)
150 {
151     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetDevicesByStates start";
152 
153     profile_ = AvrcpController::GetProfile();
154     vector<int> states = {static_cast<int>(BTConnectState::CONNECTED)};
155     vector<BluetoothRemoteDevice> devices = profile_->GetDevicesByStates(states);
156 
157     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetDevicesByStates end";
158 }
159 
160 /*
161  * @tc.number: AvrcpController007
162  * @tc.name: Connect
163  * @tc.desc: Connects to the AVRCP TG service.
164 */
165 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_Connect, TestSize.Level1)
166 {
167     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_Connect start";
168 
169     profile_ = AvrcpController::GetProfile();
170     BluetoothRemoteDevice device;
171     bool isOK = profile_->Connect(device);
172     EXPECT_EQ(isOK, true);
173 
174     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_Connect end";
175 }
176 
177 /*
178  * @tc.number: AvrcpController008
179  * @tc.name: Disconnect
180  * @tc.desc: Disconnects from the AVRCP TG service.
181 */
182 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_Disconnect, TestSize.Level1)
183 {
184     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_Disconnect start";
185 
186     profile_ = AvrcpController::GetProfile();
187     BluetoothRemoteDevice device;
188     bool isOK = profile_->Disconnect(device);
189     EXPECT_EQ(isOK, true);
190 
191     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_Disconnect end";
192 }
193 
194 /*
195  * @tc.number: AvrcpController009
196  * @tc.name: PressButton
197  * @tc.desc: Presses the button.
198 */
199 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_PressButton, TestSize.Level1)
200 {
201     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_PressButton start";
202 
203     profile_ = AvrcpController::GetProfile();
204     BluetoothRemoteDevice device;
205     uint8_t button = AVRC_KEY_OPERATION_VOLUME_UP;
206     int ret = profile_->PressButton(device, button);
207     EXPECT_EQ(ret, 0);
208 
209     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_PressButton end";
210 }
211 
212 /*
213  * @tc.number: AvrcpController010
214  * @tc.name: ReleaseButton
215  * @tc.desc: Releases the button.
216 */
217 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_ReleaseButton, TestSize.Level1)
218 {
219     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_ReleaseButton start";
220 
221     profile_ = AvrcpController::GetProfile();
222     BluetoothRemoteDevice device;
223     uint8_t button = AVRC_KEY_OPERATION_VOLUME_UP;
224     int ret = profile_->ReleaseButton(device, button);
225     EXPECT_EQ(ret, 0);
226 
227     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_ReleaseButton end";
228 }
229 
230 /*
231  * @tc.number: AvrcpController011
232  * @tc.name: GetUnitInfo
233  * @tc.desc: Gets the unit information.
234 */
235 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetUnitInfo, TestSize.Level1)
236 {
237     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetUnitInfo start";
238 
239     profile_ = AvrcpController::GetProfile();
240     BluetoothRemoteDevice device;
241     int ret = profile_->GetUnitInfo(device);
242     EXPECT_EQ(ret, 0);
243 
244     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetUnitInfo end";
245 }
246 
247 /*
248  * @tc.number: AvrcpController012
249  * @tc.name: GetSubUnitInfo
250  * @tc.desc: Gets the sub unit information.
251 */
252 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetSubUnitInfo, TestSize.Level1)
253 {
254     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetSubUnitInfo start";
255 
256     profile_ = AvrcpController::GetProfile();
257     BluetoothRemoteDevice device;
258     int ret = profile_->GetSubUnitInfo(device);
259     EXPECT_EQ(ret, 0);
260 
261     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetSubUnitInfo end";
262 }
263 
264 /*
265  * @tc.number: AvrcpController013
266  * @tc.name: SetAddressedPlayer
267  * @tc.desc: Informs which media player wishes to control.
268 */
269 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_SetAddressedPlayer, TestSize.Level1)
270 {
271     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetAddressedPlayer start";
272 
273     profile_ = AvrcpController::GetProfile();
274     BluetoothRemoteDevice device;
275     int ret = profile_->SetAddressedPlayer(device, 0);
276 
277     EXPECT_EQ(ret, RET_BAD_STATUS);
278     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetAddressedPlayer end";
279 }
280 
281 /*
282  * @tc.number: AvrcpController014
283  * @tc.name: SetBrowsedPlayer
284  * @tc.desc: Informs to which player browsing commands should be routed.
285 */
286 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_SetBrowsedPlayer, TestSize.Level1)
287 {
288     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetBrowsedPlayer start";
289 
290     profile_ = AvrcpController::GetProfile();
291     BluetoothRemoteDevice device;
292     int ret = profile_->SetBrowsedPlayer(device, 0);
293     EXPECT_EQ(ret, 0);
294 
295     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetBrowsedPlayer end";
296 }
297 
298 /*
299  * @tc.number: AvrcpController015
300  * @tc.name: GetSupportedCompanies
301  * @tc.desc: Get the supported companies by remote device.
302 */
303 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetSupportedCompanies, TestSize.Level1)
304 {
305     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetSupportedCompanies start";
306 
307     profile_ = AvrcpController::GetProfile();
308     BluetoothRemoteDevice device;
309     int ret = profile_->GetSupportedCompanies(device);
310     EXPECT_EQ(ret, 0);
311 
312     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetSupportedCompanies end";
313 }
314 
315 /*
316  * @tc.number: AvrcpController016
317  * @tc.name: GetSupportedEvents
318  * @tc.desc: Get the supported events by remote device.
319 */
320 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetSupportedEvents, TestSize.Level1)
321 {
322     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetSupportedEvents start";
323 
324     profile_ = AvrcpController::GetProfile();
325     BluetoothRemoteDevice device;
326     int ret = profile_->GetSupportedEvents(device);
327     EXPECT_EQ(ret, 0);
328 
329     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetSupportedEvents end";
330 }
331 
332 /*
333  * @tc.number: AvrcpController017
334  * @tc.name: GetPlayerAppSettingAttributes
335  * @tc.desc: Gets the attribute of the player application.
336 */
337 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetPlayerAppSettingAttributes, TestSize.Level1)
338 {
339     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerAppSettingAttributes start";
340 
341     profile_ = AvrcpController::GetProfile();
342     BluetoothRemoteDevice device;
343     int ret = profile_->GetPlayerAppSettingAttributes(device);
344     EXPECT_EQ(ret, 0);
345 
346     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerAppSettingAttributes end";
347 }
348 
349 /*
350  * @tc.number: AvrcpController018
351  * @tc.name: GetPlayerAppSettingValues
352  * @tc.desc: Gets the values of the specified attribute of the player application.
353 */
354 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetPlayerAppSettingValues, TestSize.Level1)
355 {
356     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerAppSettingValues start";
357 
358     profile_ = AvrcpController::GetProfile();
359     BluetoothRemoteDevice device;
360     int ret = profile_->GetPlayerAppSettingValues(device, ATTRIBUTES_TEST);
361     EXPECT_EQ(ret, 0);
362 
363     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerAppSettingValues end";
364 }
365 
366 /*
367  * @tc.number: AvrcpController019
368  * @tc.name: GetPlayerAppSettingCurrentValue
369  * @tc.desc: Gets the current set values on the target for the provided player application setting attributes list.
370 */
371 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetPlayerAppSettingCurrentValue, TestSize.Level1)
372 {
373     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerAppSettingCurrentValue start";
374 
375     profile_ = AvrcpController::GetProfile();
376     BluetoothRemoteDevice device;
377     vector<uint8_t> attributes = {ATTRIBUTES_TEST};
378     int ret = profile_->GetPlayerAppSettingCurrentValue(device, attributes);
379     EXPECT_EQ(ret, 0);
380 
381     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerAppSettingCurrentValue end";
382 }
383 
384 /*
385  * @tc.number: AvrcpController020
386  * @tc.name: SetPlayerAppSettingCurrentValue
387  * @tc.desc: Sets the player application setting list of player application setting values on the target device for the
388  * corresponding defined list of AvrcPlayerAttribute.
389 */
390 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_SetPlayerAppSettingCurrentValue, TestSize.Level1)
391 {
392     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetPlayerAppSettingCurrentValue start";
393 
394     profile_ = AvrcpController::GetProfile();
395     BluetoothRemoteDevice device;
396     vector<uint8_t> attributes = {ATTRIBUTES_TEST};
397     vector<uint8_t> values = {0};
398     int ret = profile_->SetPlayerAppSettingCurrentValue(device, attributes, values);
399     EXPECT_EQ(ret, 0);
400 
401     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetPlayerAppSettingCurrentValue end";
402 }
403 
404 /*
405  * @tc.number: AvrcpController021
406  * @tc.name: GetPlayerApplicationSettingAttributeText
407  * @tc.desc: provide supported player application setting attribute displayable text.
408 */
409 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetPlayerApplicationSettingAttributeText, TestSize.Level1)
410 {
411     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerApplicationSettingAttributeText start";
412 
413     profile_ = AvrcpController::GetProfile();
414     BluetoothRemoteDevice device;
415     vector<uint8_t> attributes = {ATTRIBUTES_TEST};
416 
417     int ret = profile_->GetPlayerApplicationSettingAttributeText(device, attributes);
418     EXPECT_EQ(ret, 0);
419 
420     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerApplicationSettingAttributeText end";
421 }
422 
423 /*
424  * @tc.number: AvrcpController022
425  * @tc.name: GetPlayerApplicationSettingValueText
426  * @tc.desc: request the target device to provide target supported player application setting value displayable text.
427 */
428 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetPlayerApplicationSettingValueText, TestSize.Level1)
429 {
430     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerApplicationSettingValueText start";
431 
432     profile_ = AvrcpController::GetProfile();
433     BluetoothRemoteDevice device;
434 
435     vector<uint8_t> values = {0};
436     int ret = profile_->GetPlayerApplicationSettingValueText(device, ATTRIBUTES_TEST, values);
437     EXPECT_EQ(ret, 0);
438 
439     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayerApplicationSettingValueText end";
440 }
441 
442 /*
443  * @tc.number: AvrcpController023
444  * @tc.name: GetElementAttributes
445  * @tc.desc: Requests the TG to provide the attributes of the element specified in the parameter.
446 */
447 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetElementAttributes, TestSize.Level1)
448 {
449     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetElementAttributes start";
450 
451     profile_ = AvrcpController::GetProfile();
452     BluetoothRemoteDevice device;
453     vector<uint32_t> attributes = {ATTRIBUTES_TEST};
454 
455     int ret = profile_->GetElementAttributes(device, attributes);
456     EXPECT_EQ(ret, 0);
457 
458     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetElementAttributes end";
459 }
460 
461 /*
462  * @tc.number: AvrcpController024
463  * @tc.name: GetPlayStatus
464  * @tc.desc: Gets the play status.
465 */
466 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetPlayStatus, TestSize.Level1)
467 {
468     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayStatus start";
469 
470     profile_ = AvrcpController::GetProfile();
471     BluetoothRemoteDevice device;
472     int ret = profile_->GetPlayStatus(device);
473     EXPECT_EQ(ret, 0);
474 
475     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetPlayStatus end";
476 }
477 
478 /*
479  * @tc.number: AvrcpController025
480  * @tc.name: PlayItem
481  * @tc.desc: Starts playing an item indicated by the UID.
482 */
483 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_PlayItem, TestSize.Level1)
484 {
485     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_PlayItem start";
486 
487     profile_ = AvrcpController::GetProfile();
488     BluetoothRemoteDevice device;
489     int ret = profile_->PlayItem(device, 0, 0);
490     EXPECT_EQ(ret, 0);
491 
492     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_PlayItem end";
493 }
494 
495 /*
496  * @tc.number: AvrcpController026
497  * @tc.name: AddToNowPlaying
498  * @tc.desc: Adds an item indicated by the UID to the Now Playing queue.
499 */
500 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_AddToNowPlaying, TestSize.Level1)
501 {
502     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_AddToNowPlaying start";
503 
504     profile_ = AvrcpController::GetProfile();
505     BluetoothRemoteDevice device;
506     int ret = profile_->AddToNowPlaying(device, 0, 0);
507     EXPECT_EQ (ret, RET_BAD_STATUS);
508 
509     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_AddToNowPlaying end";
510 }
511 
512 /*
513  * @tc.number: AvrcpController027
514  * @tc.name: RequestContinuingResponse
515  * @tc.desc: Requests continuing response.
516 */
517 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_RequestContinuingResponse, TestSize.Level1)
518 {
519     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_RequestContinuingResponse start";
520 
521     profile_ = AvrcpController::GetProfile();
522     BluetoothRemoteDevice device;
523     int ret = profile_->RequestContinuingResponse(device, 0);
524     EXPECT_EQ (ret, RET_BAD_STATUS);
525 
526     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_RequestContinuingResponse end";
527 }
528 
529 /*
530  * @tc.number: AvrcpController028
531  * @tc.name: AbortContinuingResponse
532  * @tc.desc: Aborts continuing response.
533 */
534 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_AbortContinuingResponse, TestSize.Level1)
535 {
536     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_AbortContinuingResponse start";
537 
538     profile_ = AvrcpController::GetProfile();
539     BluetoothRemoteDevice device;
540     int ret = profile_->AbortContinuingResponse(device, 0);
541     EXPECT_EQ (ret, RET_BAD_STATUS);
542 
543     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_AbortContinuingResponse end";
544 }
545 
546 /*
547  * @tc.number: AvrcpController029
548  * @tc.name: ChangePath
549  * @tc.desc: Navigates one level up or down in the virtual file system.
550 */
551 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_ChangePath, TestSize.Level1)
552 {
553     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_ChangePath start";
554 
555     profile_ = AvrcpController::GetProfile();
556     BluetoothRemoteDevice device;
557     int ret = profile_->ChangePath(device, 0, 0, 0);
558     EXPECT_EQ (ret, RET_BAD_STATUS);
559 
560     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_ChangePath end";
561 }
562 
563 /*
564  * @tc.number: AvrcpController030
565  * @tc.name: GetFolderItems
566  * @tc.desc: Retrieves a listing of the contents of a folder.
567 */
568 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetFolderItems, TestSize.Level1)
569 {
570     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetFolderItems start";
571 
572     profile_ = AvrcpController::GetProfile();
573     BluetoothRemoteDevice device;
574 
575     vector<uint32_t> attributes = {ITEMS_ATTRIBUTES_TEST};
576     int ret = profile_->GetFolderItems(device, 0, 1, attributes);
577     EXPECT_EQ (ret, 0);
578 
579     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetFolderItems end";
580 }
581 
582 /*
583  * @tc.number: AvrcpController031
584  * @tc.name: GetMeidaPlayerList
585  * @tc.desc: Retrieves a listing of the contents of a folder.
586 */
587 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetMeidaPlayerList, TestSize.Level1)
588 {
589     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetMeidaPlayerList start";
590 
591     profile_ = AvrcpController::GetProfile();
592     BluetoothRemoteDevice device;
593     int ret = profile_->GetMeidaPlayerList(device, 0, 1);
594     EXPECT_EQ (ret, 0);
595 
596     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetMeidaPlayerList end";
597 }
598 
599 /*
600  * @tc.number: AvrcpController032
601  * @tc.name: GetItemAttributes
602  * @tc.desc: Retrieves the metadata attributes for a particular media element item or folder item.
603 */
604 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetItemAttributes, TestSize.Level1)
605 {
606     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetItemAttributes start";
607 
608     profile_ = AvrcpController::GetProfile();
609     BluetoothRemoteDevice device;
610 
611     vector<uint32_t> attributes = {ITEMS_ATTRIBUTES_TEST};
612     int ret = profile_->GetItemAttributes(device, 0, 1, attributes);
613     EXPECT_EQ (ret, 0);
614 
615     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetItemAttributes end";
616 }
617 
618 /*
619  * @tc.number: AvrcpController033
620  * @tc.name: GetTotalNumberOfItems
621  * @tc.desc: Gets the number of items in the now playing scope.
622 */
623 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_GetTotalNumberOfItems, TestSize.Level1)
624 {
625     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetTotalNumberOfItems start";
626 
627     profile_ = AvrcpController::GetProfile();
628     BluetoothRemoteDevice device;
629     int ret = profile_->GetTotalNumberOfItems(device);
630     EXPECT_EQ (ret, 0);
631 
632     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_GetTotalNumberOfItems end";
633 }
634 
635 /*
636  * @tc.number: AvrcpController034
637  * @tc.name: SetAbsoluteVolume
638  * @tc.desc: Sets an absolute volume to be used by the rendering device.
639 */
640 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_SetAbsoluteVolume, TestSize.Level1)
641 {
642     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetAbsoluteVolume start";
643 
644     profile_ = AvrcpController::GetProfile();
645     BluetoothRemoteDevice device;
646     int ret = profile_->SetAbsoluteVolume(device, 0);
647     EXPECT_EQ (ret, 0);
648 
649     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_SetAbsoluteVolume end";
650 }
651 
652 /*
653  * @tc.number: AvrcpController035
654  * @tc.name: EnableNotification
655  * @tc.desc: Enables for receiving notifications asynchronously based on specific events occurring.
656 */
657 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_EnableNotification, TestSize.Level1)
658 {
659     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_EnableNotification start";
660 
661     profile_ = AvrcpController::GetProfile();
662     BluetoothRemoteDevice device;
663 
664     vector<uint8_t> events = {0};
665     int ret = profile_->EnableNotification(device, events);
666     EXPECT_EQ (ret, 0);
667 
668     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_EnableNotification end";
669 }
670 
671 /*
672  * @tc.number: AvrcpController036
673  * @tc.name: DisableNotification
674  * @tc.desc: Disables for receiving notifications asynchronously based on specific events occurring.
675 */
676 HWTEST_F(AvrcpControllerTest, AvrcpController_UnitTest_DisableNotification, TestSize.Level1)
677 {
678     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_DisableNotification start";
679 
680     profile_ = AvrcpController::GetProfile();
681     BluetoothRemoteDevice device;
682 
683     vector<uint8_t> events = {0};
684     int ret = profile_->DisableNotification(device, events);
685     EXPECT_EQ (ret, 0);
686 
687     GTEST_LOG_(INFO) << "AvrcpController_UnitTest_DisableNotification end";
688 }
689 }  // namespace Bluetooth
690 }  // namespace OHOS