119e95205Sopenharmony_ci/*
219e95205Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd.
319e95205Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
419e95205Sopenharmony_ci * you may not use this file except in compliance with the License.
519e95205Sopenharmony_ci * You may obtain a copy of the License at
619e95205Sopenharmony_ci *
719e95205Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
819e95205Sopenharmony_ci *
919e95205Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1019e95205Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1119e95205Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1219e95205Sopenharmony_ci * See the License for the specific language governing permissions and
1319e95205Sopenharmony_ci * limitations under the License.
1419e95205Sopenharmony_ci */
1519e95205Sopenharmony_ci#include <gmock/gmock.h>
1619e95205Sopenharmony_ci#include <gtest/gtest.h>
1719e95205Sopenharmony_ci#include "bluetooth_map_mce.h"
1819e95205Sopenharmony_ci#include "bluetooth_host.h"
1919e95205Sopenharmony_ci#include "bluetooth_def.h"
2019e95205Sopenharmony_ci
2119e95205Sopenharmony_ciusing namespace testing;
2219e95205Sopenharmony_ciusing namespace testing::ext;
2319e95205Sopenharmony_ciusing namespace std;
2419e95205Sopenharmony_ci
2519e95205Sopenharmony_cinamespace OHOS {
2619e95205Sopenharmony_cinamespace Bluetooth {
2719e95205Sopenharmony_ciconstexpr int TIME = 2;
2819e95205Sopenharmony_ci
2919e95205Sopenharmony_ciclass MapClientObserverCommon : public MapClientObserver{
3019e95205Sopenharmony_cipublic:
3119e95205Sopenharmony_ci    MapClientObserverCommon() = default;
3219e95205Sopenharmony_ci    virtual ~MapClientObserverCommon() = default;
3319e95205Sopenharmony_ci
3419e95205Sopenharmony_ci    void OnMapActionCompleted(
3519e95205Sopenharmony_ci        const BluetoothRemoteDevice &device, const MapAction &action, MapExecuteStatus status) {}
3619e95205Sopenharmony_ci
3719e95205Sopenharmony_ci    void OnMapEventReported(const BluetoothRemoteDevice &device, const MapEventReport &report) {}
3819e95205Sopenharmony_ci
3919e95205Sopenharmony_ci    void OnConnectionStateChanged(const BluetoothRemoteDevice &device, int state) {}
4019e95205Sopenharmony_ci
4119e95205Sopenharmony_ci    void OnBmessageCompleted(
4219e95205Sopenharmony_ci        const BluetoothRemoteDevice &deviceAddress, const MapBMessage &bmsg, MapExecuteStatus status) {}
4319e95205Sopenharmony_ci
4419e95205Sopenharmony_ci    void OnMessagesListingCompleted(
4519e95205Sopenharmony_ci        const BluetoothRemoteDevice &deviceAddress, const MessagesListing &listing, MapExecuteStatus status) {}
4619e95205Sopenharmony_ci
4719e95205Sopenharmony_ci    void OnConversationListingCompleted(
4819e95205Sopenharmony_ci        const BluetoothRemoteDevice &deviceAddress, const ConversationListing &listing, MapExecuteStatus status) {}
4919e95205Sopenharmony_ci
5019e95205Sopenharmony_ciprivate:
5119e95205Sopenharmony_ci};
5219e95205Sopenharmony_ci
5319e95205Sopenharmony_cistatic MapClientObserverCommon observer_;
5419e95205Sopenharmony_cistatic MapClient *profile_;
5519e95205Sopenharmony_ci
5619e95205Sopenharmony_ciclass MapClientTest : public testing::Test {
5719e95205Sopenharmony_cipublic:
5819e95205Sopenharmony_ci    MapClientTest()
5919e95205Sopenharmony_ci    {}
6019e95205Sopenharmony_ci    ~MapClientTest()
6119e95205Sopenharmony_ci    {}
6219e95205Sopenharmony_ci
6319e95205Sopenharmony_ci    static void SetUpTestCase(void);
6419e95205Sopenharmony_ci    static void TearDownTestCase(void);
6519e95205Sopenharmony_ci    void SetUp();
6619e95205Sopenharmony_ci    void TearDown();
6719e95205Sopenharmony_ci    BluetoothHost *host_;
6819e95205Sopenharmony_ci};
6919e95205Sopenharmony_ci
7019e95205Sopenharmony_ci
7119e95205Sopenharmony_civoid MapClientTest::SetUpTestCase(void)
7219e95205Sopenharmony_ci{}
7319e95205Sopenharmony_civoid MapClientTest::TearDownTestCase(void)
7419e95205Sopenharmony_ci{}
7519e95205Sopenharmony_civoid MapClientTest::SetUp()
7619e95205Sopenharmony_ci{
7719e95205Sopenharmony_ci    host_ = &BluetoothHost::GetDefaultHost();
7819e95205Sopenharmony_ci    host_->EnableBt();
7919e95205Sopenharmony_ci    host_->EnableBle();
8019e95205Sopenharmony_ci    sleep(TIME);
8119e95205Sopenharmony_ci}
8219e95205Sopenharmony_ci
8319e95205Sopenharmony_civoid MapClientTest::TearDown()
8419e95205Sopenharmony_ci{
8519e95205Sopenharmony_ci    host_->DisableBt();
8619e95205Sopenharmony_ci    host_->DisableBle();
8719e95205Sopenharmony_ci    host_ = nullptr;
8819e95205Sopenharmony_ci}
8919e95205Sopenharmony_ci
9019e95205Sopenharmony_ci
9119e95205Sopenharmony_ci
9219e95205Sopenharmony_ci/*
9319e95205Sopenharmony_ci * @tc.number: MapClient001
9419e95205Sopenharmony_ci * @tc.name: GetProfile
9519e95205Sopenharmony_ci * @tc.desc: Get the Profile object.
9619e95205Sopenharmony_ci*/
9719e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetProfile, TestSize.Level1)
9819e95205Sopenharmony_ci{
9919e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetProfile start";
10019e95205Sopenharmony_ci
10119e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
10219e95205Sopenharmony_ci
10319e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetProfile end";
10419e95205Sopenharmony_ci}
10519e95205Sopenharmony_ci
10619e95205Sopenharmony_ci
10719e95205Sopenharmony_ci/*
10819e95205Sopenharmony_ci * @tc.number: MapClient002
10919e95205Sopenharmony_ci * @tc.name: RegisterObserver
11019e95205Sopenharmony_ci * @tc.desc: Register Observer.
11119e95205Sopenharmony_ci*/
11219e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_RegisterObserver, TestSize.Level1)
11319e95205Sopenharmony_ci{
11419e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_RegisterObserver start";
11519e95205Sopenharmony_ci
11619e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
11719e95205Sopenharmony_ci    profile_->RegisterObserver(observer_);
11819e95205Sopenharmony_ci    sleep(TIME);
11919e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_RegisterObserver end";
12019e95205Sopenharmony_ci}
12119e95205Sopenharmony_ci
12219e95205Sopenharmony_ci
12319e95205Sopenharmony_ci/*
12419e95205Sopenharmony_ci * @tc.number: MapClient003
12519e95205Sopenharmony_ci * @tc.name: DeregisterObserver
12619e95205Sopenharmony_ci * @tc.desc: Deregister Observer.
12719e95205Sopenharmony_ci*/
12819e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_DeregisterObserver, TestSize.Level1)
12919e95205Sopenharmony_ci{
13019e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_DeregisterObserver start";
13119e95205Sopenharmony_ci
13219e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
13319e95205Sopenharmony_ci    profile_->DeregisterObserver(observer_);
13419e95205Sopenharmony_ci    sleep(TIME);
13519e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_DeregisterObserver end";
13619e95205Sopenharmony_ci}
13719e95205Sopenharmony_ci
13819e95205Sopenharmony_ci
13919e95205Sopenharmony_ci/*
14019e95205Sopenharmony_ci * @tc.number: MapClient004
14119e95205Sopenharmony_ci * @tc.name: Connect
14219e95205Sopenharmony_ci * @tc.desc: Connect to map server.
14319e95205Sopenharmony_ci*/
14419e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_Connect, TestSize.Level1)
14519e95205Sopenharmony_ci{
14619e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_Connect start";
14719e95205Sopenharmony_ci
14819e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
14919e95205Sopenharmony_ci    BluetoothRemoteDevice device;
15019e95205Sopenharmony_ci    bool ret = profile_->Connect(device);
15119e95205Sopenharmony_ci    sleep(TIME);
15219e95205Sopenharmony_ci    EXPECT_EQ(ret, true);
15319e95205Sopenharmony_ci
15419e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_Connect end";
15519e95205Sopenharmony_ci}
15619e95205Sopenharmony_ci
15719e95205Sopenharmony_ci
15819e95205Sopenharmony_ci/*
15919e95205Sopenharmony_ci * @tc.number: MapClient005
16019e95205Sopenharmony_ci * @tc.name: Disconnect
16119e95205Sopenharmony_ci * @tc.desc: disconnect from map server.
16219e95205Sopenharmony_ci*/
16319e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_Disconnect, TestSize.Level1)
16419e95205Sopenharmony_ci{
16519e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_Disconnect start";
16619e95205Sopenharmony_ci
16719e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
16819e95205Sopenharmony_ci    BluetoothRemoteDevice device;
16919e95205Sopenharmony_ci    bool ret = profile_->Disconnect(device);
17019e95205Sopenharmony_ci    sleep(TIME);
17119e95205Sopenharmony_ci    EXPECT_EQ(ret, true);
17219e95205Sopenharmony_ci
17319e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_Disconnect end";
17419e95205Sopenharmony_ci}
17519e95205Sopenharmony_ci
17619e95205Sopenharmony_ci
17719e95205Sopenharmony_ci/*
17819e95205Sopenharmony_ci * @tc.number: MapClient006
17919e95205Sopenharmony_ci * @tc.name: IsConnected
18019e95205Sopenharmony_ci * @tc.desc: display connect status.
18119e95205Sopenharmony_ci*/
18219e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_IsConnected, TestSize.Level1)
18319e95205Sopenharmony_ci{
18419e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_IsConnected start";
18519e95205Sopenharmony_ci
18619e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
18719e95205Sopenharmony_ci    BluetoothRemoteDevice device;
18819e95205Sopenharmony_ci    bool ret = profile_->IsConnected(device);
18919e95205Sopenharmony_ci    sleep(TIME);
19019e95205Sopenharmony_ci    EXPECT_EQ(ret, true);
19119e95205Sopenharmony_ci
19219e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_IsConnected end";
19319e95205Sopenharmony_ci}
19419e95205Sopenharmony_ci
19519e95205Sopenharmony_ci
19619e95205Sopenharmony_ci/*
19719e95205Sopenharmony_ci * @tc.number: MapClient007
19819e95205Sopenharmony_ci * @tc.name: GetConnectedDevices
19919e95205Sopenharmony_ci * @tc.desc: Get the Connected Devices object.
20019e95205Sopenharmony_ci*/
20119e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetConnectedDevices, TestSize.Level1)
20219e95205Sopenharmony_ci{
20319e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConnectedDevices start";
20419e95205Sopenharmony_ci
20519e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
20619e95205Sopenharmony_ci    vector<BluetoothRemoteDevice> devices = profile_->GetConnectedDevices();
20719e95205Sopenharmony_ci    sleep(TIME);
20819e95205Sopenharmony_ci
20919e95205Sopenharmony_ci
21019e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConnectedDevices end";
21119e95205Sopenharmony_ci}
21219e95205Sopenharmony_ci
21319e95205Sopenharmony_ci
21419e95205Sopenharmony_ci/*
21519e95205Sopenharmony_ci * @tc.number: MapClient008
21619e95205Sopenharmony_ci * @tc.name: GetDevicesByStates
21719e95205Sopenharmony_ci * @tc.desc: Get the device list through the connection status.
21819e95205Sopenharmony_ci*/
21919e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetDevicesByStates, TestSize.Level1)
22019e95205Sopenharmony_ci{
22119e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetDevicesByStates start";
22219e95205Sopenharmony_ci
22319e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
22419e95205Sopenharmony_ci
22519e95205Sopenharmony_ci    vector<int> statusList = {static_cast<int>(BTConnectState::CONNECTED)};
22619e95205Sopenharmony_ci    vector<BluetoothRemoteDevice> devices = profile_->GetDevicesByStates(statusList);
22719e95205Sopenharmony_ci    sleep(TIME);
22819e95205Sopenharmony_ci
22919e95205Sopenharmony_ci
23019e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetDevicesByStates end";
23119e95205Sopenharmony_ci}
23219e95205Sopenharmony_ci
23319e95205Sopenharmony_ci
23419e95205Sopenharmony_ci/*
23519e95205Sopenharmony_ci * @tc.number: MapClient009
23619e95205Sopenharmony_ci * @tc.name: GetConnectionState
23719e95205Sopenharmony_ci * @tc.desc: Get the Connection State object.
23819e95205Sopenharmony_ci*/
23919e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetConnectionState, TestSize.Level1)
24019e95205Sopenharmony_ci{
24119e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConnectionState start";
24219e95205Sopenharmony_ci
24319e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
24419e95205Sopenharmony_ci    BluetoothRemoteDevice device;
24519e95205Sopenharmony_ci    int ret = profile_->GetConnectionState(device);
24619e95205Sopenharmony_ci    sleep(TIME);
24719e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
24819e95205Sopenharmony_ci
24919e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConnectionState end";
25019e95205Sopenharmony_ci}
25119e95205Sopenharmony_ci
25219e95205Sopenharmony_ci
25319e95205Sopenharmony_ci/*
25419e95205Sopenharmony_ci * @tc.number: MapClient010
25519e95205Sopenharmony_ci * @tc.name: SetConnectionStrategy
25619e95205Sopenharmony_ci * @tc.desc: Set the connection policy of the specified device.
25719e95205Sopenharmony_ci*/
25819e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_SetConnectionStrategy, TestSize.Level1)
25919e95205Sopenharmony_ci{
26019e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetConnectionStrategy start";
26119e95205Sopenharmony_ci
26219e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
26319e95205Sopenharmony_ci    BluetoothRemoteDevice device;
26419e95205Sopenharmony_ci    bool ret = profile_->SetConnectionStrategy(device, 0);
26519e95205Sopenharmony_ci    sleep(TIME);
26619e95205Sopenharmony_ci    EXPECT_EQ(ret, true);
26719e95205Sopenharmony_ci
26819e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetConnectionStrategy end";
26919e95205Sopenharmony_ci}
27019e95205Sopenharmony_ci
27119e95205Sopenharmony_ci
27219e95205Sopenharmony_ci/*
27319e95205Sopenharmony_ci * @tc.number: MapClient011
27419e95205Sopenharmony_ci * @tc.name: GetConnectionStrategy
27519e95205Sopenharmony_ci * @tc.desc: Get the Connection Strategy object.
27619e95205Sopenharmony_ci*/
27719e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetConnectionStrategy, TestSize.Level1)
27819e95205Sopenharmony_ci{
27919e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConnectionStrategy start";
28019e95205Sopenharmony_ci
28119e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
28219e95205Sopenharmony_ci    BluetoothRemoteDevice device;
28319e95205Sopenharmony_ci    int ret = profile_->GetConnectionStrategy(device);
28419e95205Sopenharmony_ci    sleep(TIME);
28519e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
28619e95205Sopenharmony_ci
28719e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConnectionStrategy end";
28819e95205Sopenharmony_ci}
28919e95205Sopenharmony_ci
29019e95205Sopenharmony_ci
29119e95205Sopenharmony_ci/*
29219e95205Sopenharmony_ci * @tc.number: MapClient012
29319e95205Sopenharmony_ci * @tc.name: GetUnreadMessages
29419e95205Sopenharmony_ci * @tc.desc: Get the Unread Messages object.
29519e95205Sopenharmony_ci*/
29619e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetUnreadMessages, TestSize.Level1)
29719e95205Sopenharmony_ci{
29819e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetUnreadMessages start";
29919e95205Sopenharmony_ci
30019e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
30119e95205Sopenharmony_ci    BluetoothRemoteDevice device;
30219e95205Sopenharmony_ci    MapMessageType type = MapMessageType::SMS_GSM;
30319e95205Sopenharmony_ci    bool ret = profile_->GetUnreadMessages(device, type, 3);
30419e95205Sopenharmony_ci    sleep(TIME);
30519e95205Sopenharmony_ci    EXPECT_EQ(ret, true);
30619e95205Sopenharmony_ci
30719e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetUnreadMessages end";
30819e95205Sopenharmony_ci}
30919e95205Sopenharmony_ci
31019e95205Sopenharmony_ci
31119e95205Sopenharmony_ci/*
31219e95205Sopenharmony_ci * @tc.number: MapClient013
31319e95205Sopenharmony_ci * @tc.name: GetSupportedFeatures
31419e95205Sopenharmony_ci * @tc.desc: Get the Supported Features object.
31519e95205Sopenharmony_ci*/
31619e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetSupportedFeatures, TestSize.Level1)
31719e95205Sopenharmony_ci{
31819e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetSupportedFeatures start";
31919e95205Sopenharmony_ci
32019e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
32119e95205Sopenharmony_ci    BluetoothRemoteDevice device;
32219e95205Sopenharmony_ci    int ret = profile_->GetSupportedFeatures(device);
32319e95205Sopenharmony_ci    sleep(TIME);
32419e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
32519e95205Sopenharmony_ci
32619e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetSupportedFeatures end";
32719e95205Sopenharmony_ci}
32819e95205Sopenharmony_ci
32919e95205Sopenharmony_ci
33019e95205Sopenharmony_ci/*
33119e95205Sopenharmony_ci * @tc.number: MapClient014
33219e95205Sopenharmony_ci * @tc.name: SendMessage
33319e95205Sopenharmony_ci * @tc.desc: Send Message.
33419e95205Sopenharmony_ci*/
33519e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_SendMessage, TestSize.Level1)
33619e95205Sopenharmony_ci{
33719e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SendMessage start";
33819e95205Sopenharmony_ci
33919e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
34019e95205Sopenharmony_ci    BluetoothRemoteDevice device;
34119e95205Sopenharmony_ci    MapSendMessageParameters message;
34219e95205Sopenharmony_ci    int ret = profile_->SendMessage(device, message);
34319e95205Sopenharmony_ci    sleep(TIME);
34419e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
34519e95205Sopenharmony_ci
34619e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SendMessage end";
34719e95205Sopenharmony_ci}
34819e95205Sopenharmony_ci
34919e95205Sopenharmony_ci
35019e95205Sopenharmony_ci/*
35119e95205Sopenharmony_ci * @tc.number: MapClient015
35219e95205Sopenharmony_ci * @tc.name: SetNotificationFilter
35319e95205Sopenharmony_ci * @tc.desc: Set the Notification Filter object.
35419e95205Sopenharmony_ci*/
35519e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_SetNotificationFilter, TestSize.Level1)
35619e95205Sopenharmony_ci{
35719e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetNotificationFilter start";
35819e95205Sopenharmony_ci
35919e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
36019e95205Sopenharmony_ci    BluetoothRemoteDevice device;
36119e95205Sopenharmony_ci    int mask = MAP_NOTIFICATION_FILTER_MASK_NEW_MESSAGE;
36219e95205Sopenharmony_ci    int ret = profile_->SetNotificationFilter(device, mask);
36319e95205Sopenharmony_ci    sleep(TIME);
36419e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
36519e95205Sopenharmony_ci
36619e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetNotificationFilter end";
36719e95205Sopenharmony_ci}
36819e95205Sopenharmony_ci
36919e95205Sopenharmony_ci
37019e95205Sopenharmony_ci/*
37119e95205Sopenharmony_ci * @tc.number: MapClient016
37219e95205Sopenharmony_ci * @tc.name: GetMessagesListing
37319e95205Sopenharmony_ci * @tc.desc: Get the Messages Listing object.
37419e95205Sopenharmony_ci*/
37519e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetMessagesListing, TestSize.Level1)
37619e95205Sopenharmony_ci{
37719e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetMessagesListing start";
37819e95205Sopenharmony_ci
37919e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
38019e95205Sopenharmony_ci    BluetoothRemoteDevice device;
38119e95205Sopenharmony_ci    GetMessagesListingParameters para;
38219e95205Sopenharmony_ci    int ret = profile_->GetMessagesListing(device, para);
38319e95205Sopenharmony_ci    sleep(TIME);
38419e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
38519e95205Sopenharmony_ci
38619e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetMessagesListing end";
38719e95205Sopenharmony_ci}
38819e95205Sopenharmony_ci
38919e95205Sopenharmony_ci
39019e95205Sopenharmony_ci/*
39119e95205Sopenharmony_ci * @tc.number: MapClient017
39219e95205Sopenharmony_ci * @tc.name: GetMessage
39319e95205Sopenharmony_ci * @tc.desc: Get the Message object.
39419e95205Sopenharmony_ci*/
39519e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetMessage, TestSize.Level1)
39619e95205Sopenharmony_ci{
39719e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetMessage start";
39819e95205Sopenharmony_ci
39919e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
40019e95205Sopenharmony_ci    BluetoothRemoteDevice device;
40119e95205Sopenharmony_ci
40219e95205Sopenharmony_ci    GetMessageParameters para;
40319e95205Sopenharmony_ci    MapMessageType type = MapMessageType::SMS_GSM;
40419e95205Sopenharmony_ci    std::u16string msgHandle = {'a', 'b', 'c'};
40519e95205Sopenharmony_ci    int ret = profile_->GetMessage(device, type, msgHandle, para);
40619e95205Sopenharmony_ci    sleep(TIME);
40719e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
40819e95205Sopenharmony_ci
40919e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetMessage end";
41019e95205Sopenharmony_ci}
41119e95205Sopenharmony_ci
41219e95205Sopenharmony_ci
41319e95205Sopenharmony_ci/*
41419e95205Sopenharmony_ci * @tc.number: MapClient018
41519e95205Sopenharmony_ci * @tc.name: UpdateInbox
41619e95205Sopenharmony_ci * @tc.desc: Update Inbox.
41719e95205Sopenharmony_ci*/
41819e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_UpdateInbox, TestSize.Level1)
41919e95205Sopenharmony_ci{
42019e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_UpdateInbox start";
42119e95205Sopenharmony_ci
42219e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
42319e95205Sopenharmony_ci    BluetoothRemoteDevice device;
42419e95205Sopenharmony_ci
42519e95205Sopenharmony_ci    MapMessageType type = MapMessageType::SMS_GSM;
42619e95205Sopenharmony_ci    int ret = profile_->UpdateInbox(device, type);
42719e95205Sopenharmony_ci    sleep(TIME);
42819e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
42919e95205Sopenharmony_ci
43019e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_UpdateInbox end";
43119e95205Sopenharmony_ci}
43219e95205Sopenharmony_ci
43319e95205Sopenharmony_ci
43419e95205Sopenharmony_ci/*
43519e95205Sopenharmony_ci * @tc.number: MapClient019
43619e95205Sopenharmony_ci * @tc.name: GetConversationListing
43719e95205Sopenharmony_ci * @tc.desc: Get the Conversation Listing object.
43819e95205Sopenharmony_ci*/
43919e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetConversationListing, TestSize.Level1)
44019e95205Sopenharmony_ci{
44119e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConversationListing start";
44219e95205Sopenharmony_ci
44319e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
44419e95205Sopenharmony_ci    BluetoothRemoteDevice device;
44519e95205Sopenharmony_ci
44619e95205Sopenharmony_ci    GetConversationListingParameters para;
44719e95205Sopenharmony_ci    int ret = profile_->GetConversationListing(device, para);
44819e95205Sopenharmony_ci    sleep(TIME);
44919e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
45019e95205Sopenharmony_ci
45119e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetConversationListing end";
45219e95205Sopenharmony_ci}
45319e95205Sopenharmony_ci
45419e95205Sopenharmony_ci
45519e95205Sopenharmony_ci/*
45619e95205Sopenharmony_ci * @tc.number: MapClient020
45719e95205Sopenharmony_ci * @tc.name: SetMessageStatus
45819e95205Sopenharmony_ci * @tc.desc: Set the Message Status object.
45919e95205Sopenharmony_ci*/
46019e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_SetMessageStatus, TestSize.Level1)
46119e95205Sopenharmony_ci{
46219e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetMessageStatus start";
46319e95205Sopenharmony_ci
46419e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
46519e95205Sopenharmony_ci    BluetoothRemoteDevice device;
46619e95205Sopenharmony_ci
46719e95205Sopenharmony_ci    MapMessageType type = MapMessageType::SMS_GSM;
46819e95205Sopenharmony_ci    MapSetMessageStatus msgStatus;
46919e95205Sopenharmony_ci    int ret = profile_->SetMessageStatus(device, type, msgStatus);
47019e95205Sopenharmony_ci    sleep(TIME);
47119e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
47219e95205Sopenharmony_ci
47319e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetMessageStatus end";
47419e95205Sopenharmony_ci}
47519e95205Sopenharmony_ci
47619e95205Sopenharmony_ci
47719e95205Sopenharmony_ci/*
47819e95205Sopenharmony_ci * @tc.number: MapClient021
47919e95205Sopenharmony_ci * @tc.name: SetOwnerStatus
48019e95205Sopenharmony_ci * @tc.desc: Set the Owner Status object.
48119e95205Sopenharmony_ci*/
48219e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_SetOwnerStatus, TestSize.Level1)
48319e95205Sopenharmony_ci{
48419e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetOwnerStatus start";
48519e95205Sopenharmony_ci
48619e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
48719e95205Sopenharmony_ci    BluetoothRemoteDevice device;
48819e95205Sopenharmony_ci
48919e95205Sopenharmony_ci    SetOwnerStatusParameters para;
49019e95205Sopenharmony_ci    int ret = profile_->SetOwnerStatus(device, para);
49119e95205Sopenharmony_ci    sleep(TIME);
49219e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
49319e95205Sopenharmony_ci
49419e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_SetOwnerStatus end";
49519e95205Sopenharmony_ci}
49619e95205Sopenharmony_ci
49719e95205Sopenharmony_ci
49819e95205Sopenharmony_ci/*
49919e95205Sopenharmony_ci * @tc.number: MapClient022
50019e95205Sopenharmony_ci * @tc.name: GetOwnerStatus
50119e95205Sopenharmony_ci * @tc.desc: Get the Owner Status object.
50219e95205Sopenharmony_ci*/
50319e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetOwnerStatus, TestSize.Level1)
50419e95205Sopenharmony_ci{
50519e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetOwnerStatus start";
50619e95205Sopenharmony_ci
50719e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
50819e95205Sopenharmony_ci    BluetoothRemoteDevice device;
50919e95205Sopenharmony_ci
51019e95205Sopenharmony_ci    std::string conversationId = "GetOwnerStatus test";
51119e95205Sopenharmony_ci    int ret = profile_->GetOwnerStatus(device, conversationId);
51219e95205Sopenharmony_ci    sleep(TIME);
51319e95205Sopenharmony_ci    EXPECT_EQ(ret, 0);
51419e95205Sopenharmony_ci
51519e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetOwnerStatus end";
51619e95205Sopenharmony_ci}
51719e95205Sopenharmony_ci
51819e95205Sopenharmony_ci
51919e95205Sopenharmony_ci/*
52019e95205Sopenharmony_ci * @tc.number: MapClient023
52119e95205Sopenharmony_ci * @tc.name: GetMasInstanceInfo
52219e95205Sopenharmony_ci * @tc.desc: Get the Mas Instance Info object.
52319e95205Sopenharmony_ci*/
52419e95205Sopenharmony_ciHWTEST_F(MapClientTest, Avrcp_UnitTest_GetMasInstanceInfo, TestSize.Level1)
52519e95205Sopenharmony_ci{
52619e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetMasInstanceInfo start";
52719e95205Sopenharmony_ci
52819e95205Sopenharmony_ci    profile_ = MapClient::GetProfile();
52919e95205Sopenharmony_ci    BluetoothRemoteDevice device;
53019e95205Sopenharmony_ci
53119e95205Sopenharmony_ci    profile_->GetMasInstanceInfo(device);
53219e95205Sopenharmony_ci    sleep(TIME);
53319e95205Sopenharmony_ci
53419e95205Sopenharmony_ci    GTEST_LOG_(INFO) << "Avrcp_UnitTest_GetMasInstanceInfo end";
53519e95205Sopenharmony_ci}
53619e95205Sopenharmony_ci
53719e95205Sopenharmony_ci
53819e95205Sopenharmony_ci}  // namespace Bluetooth
53919e95205Sopenharmony_ci}  // namespace OHOS