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 1619e95205Sopenharmony_ci#include <gmock/gmock.h> 1719e95205Sopenharmony_ci#include <gtest/gtest.h> 1819e95205Sopenharmony_ci 1919e95205Sopenharmony_ci#include "bluetooth_errorcode.h" 2019e95205Sopenharmony_ci#include "bluetooth_gatt_client.h" 2119e95205Sopenharmony_ci#include "bluetooth_gatt_descriptor.h" 2219e95205Sopenharmony_ci#include "bluetooth_host.h" 2319e95205Sopenharmony_ci#include "uuid.h" 2419e95205Sopenharmony_ci#include "vector" 2519e95205Sopenharmony_ci 2619e95205Sopenharmony_ciusing namespace testing; 2719e95205Sopenharmony_ciusing namespace testing::ext; 2819e95205Sopenharmony_cinamespace OHOS { 2919e95205Sopenharmony_cinamespace Bluetooth { 3019e95205Sopenharmony_ciclass GattClientCallbackTest : public GattClientCallback { 3119e95205Sopenharmony_cipublic: 3219e95205Sopenharmony_ci GattClientCallbackTest() 3319e95205Sopenharmony_ci {} 3419e95205Sopenharmony_ci ~GattClientCallbackTest() 3519e95205Sopenharmony_ci {} 3619e95205Sopenharmony_ci 3719e95205Sopenharmony_ci void OnConnectionStateChanged(int connectionState, int ret) 3819e95205Sopenharmony_ci { 3919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnConnectionStateChanged called"; 4019e95205Sopenharmony_ci } 4119e95205Sopenharmony_ci 4219e95205Sopenharmony_ci void OnCharacteristicChanged(const GattCharacteristic &characteristic) 4319e95205Sopenharmony_ci { 4419e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnCharacteristicChanged called"; 4519e95205Sopenharmony_ci } 4619e95205Sopenharmony_ci 4719e95205Sopenharmony_ci void OnCharacteristicReadResult(const GattCharacteristic &characteristic, int ret) 4819e95205Sopenharmony_ci { 4919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnCharacteristicReadResult called"; 5019e95205Sopenharmony_ci } 5119e95205Sopenharmony_ci 5219e95205Sopenharmony_ci void OnCharacteristicWriteResult(const GattCharacteristic &characteristic, int ret) 5319e95205Sopenharmony_ci { 5419e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnCharacteristicWriteResult called"; 5519e95205Sopenharmony_ci } 5619e95205Sopenharmony_ci 5719e95205Sopenharmony_ci void OnDescriptorReadResult(const GattDescriptor &descriptor, int ret) 5819e95205Sopenharmony_ci { 5919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnDescriptorReadResult called"; 6019e95205Sopenharmony_ci } 6119e95205Sopenharmony_ci 6219e95205Sopenharmony_ci void OnDescriptorWriteResult(const GattDescriptor &descriptor, int ret) 6319e95205Sopenharmony_ci { 6419e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnDescriptorWriteResult called"; 6519e95205Sopenharmony_ci } 6619e95205Sopenharmony_ci 6719e95205Sopenharmony_ci void OnMtuUpdate(int mtu, int ret) 6819e95205Sopenharmony_ci { 6919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnMtuUpdate called"; 7019e95205Sopenharmony_ci } 7119e95205Sopenharmony_ci 7219e95205Sopenharmony_ci void OnServicesDiscovered(int status) 7319e95205Sopenharmony_ci { 7419e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnServicesDiscovered called"; 7519e95205Sopenharmony_ci } 7619e95205Sopenharmony_ci 7719e95205Sopenharmony_ci void OnConnectionParameterChanged(int interval, int latency, int timeout, int status) 7819e95205Sopenharmony_ci { 7919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnConnectionParameterChanged called"; 8019e95205Sopenharmony_ci } 8119e95205Sopenharmony_ci 8219e95205Sopenharmony_ci void OnSetNotifyCharacteristic(int status) 8319e95205Sopenharmony_ci { 8419e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClientCallbackTest::OnSetNotifyCharacteristic called"; 8519e95205Sopenharmony_ci } 8619e95205Sopenharmony_ci}; 8719e95205Sopenharmony_ci 8819e95205Sopenharmony_ciclass GattClientTest : public testing::Test { 8919e95205Sopenharmony_cipublic: 9019e95205Sopenharmony_ci GattClientTest() 9119e95205Sopenharmony_ci {} 9219e95205Sopenharmony_ci ~GattClientTest() 9319e95205Sopenharmony_ci {} 9419e95205Sopenharmony_ci 9519e95205Sopenharmony_ci int tempData_ = 0; 9619e95205Sopenharmony_ci static void SetUpTestCase(void); 9719e95205Sopenharmony_ci static void TearDownTestCase(void); 9819e95205Sopenharmony_ci void SetUp(); 9919e95205Sopenharmony_ci void TearDown(); 10019e95205Sopenharmony_ci}; 10119e95205Sopenharmony_ci 10219e95205Sopenharmony_civoid GattClientTest::SetUpTestCase(void) 10319e95205Sopenharmony_ci{} 10419e95205Sopenharmony_civoid GattClientTest::TearDownTestCase(void) 10519e95205Sopenharmony_ci{} 10619e95205Sopenharmony_civoid GattClientTest::SetUp() 10719e95205Sopenharmony_ci{ 10819e95205Sopenharmony_ci tempData_ = 0; 10919e95205Sopenharmony_ci} 11019e95205Sopenharmony_ci 11119e95205Sopenharmony_civoid GattClientTest::TearDown() 11219e95205Sopenharmony_ci{} 11319e95205Sopenharmony_ci 11419e95205Sopenharmony_ci/* 11519e95205Sopenharmony_ci * @tc.number: GattClient001 11619e95205Sopenharmony_ci * @tc.name: GattClient 11719e95205Sopenharmony_ci*/ 11819e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_GattClient, TestSize.Level1) 11919e95205Sopenharmony_ci{ 12019e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_GattClient start"; 12119e95205Sopenharmony_ci BluetoothRemoteDevice device; 12219e95205Sopenharmony_ci GattClient client(device); 12319e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_GattClient end"; 12419e95205Sopenharmony_ci} 12519e95205Sopenharmony_ci 12619e95205Sopenharmony_ci/* 12719e95205Sopenharmony_ci * @tc.number: GattClient002 12819e95205Sopenharmony_ci * @tc.name: Connect 12919e95205Sopenharmony_ci*/ 13019e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_Connect, TestSize.Level1) 13119e95205Sopenharmony_ci{ 13219e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_Connect start"; 13319e95205Sopenharmony_ci BluetoothRemoteDevice device; 13419e95205Sopenharmony_ci GattClient client(device); 13519e95205Sopenharmony_ci GattClientCallbackTest callback_; 13619e95205Sopenharmony_ci bool isAutoConnect = true; 13719e95205Sopenharmony_ci int transport = 1; 13819e95205Sopenharmony_ci int result = client.Connect(callback_, isAutoConnect, transport); 13919e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 14019e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_Connect end"; 14119e95205Sopenharmony_ci} 14219e95205Sopenharmony_ci 14319e95205Sopenharmony_ci/* 14419e95205Sopenharmony_ci * @tc.number: GattClient003 14519e95205Sopenharmony_ci * @tc.name: Disconnect 14619e95205Sopenharmony_ci*/ 14719e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_Disconnect, TestSize.Level1) 14819e95205Sopenharmony_ci{ 14919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_Disconnect start"; 15019e95205Sopenharmony_ci BluetoothRemoteDevice device; 15119e95205Sopenharmony_ci GattClient client(device); 15219e95205Sopenharmony_ci GattClientCallbackTest callback_; 15319e95205Sopenharmony_ci bool isAutoConnect = true; 15419e95205Sopenharmony_ci int transport = 1; 15519e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 15619e95205Sopenharmony_ci int result = client.Disconnect(); 15719e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 15819e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_Disconnect end"; 15919e95205Sopenharmony_ci} 16019e95205Sopenharmony_ci 16119e95205Sopenharmony_ci/* 16219e95205Sopenharmony_ci * @tc.number: GattClient004 16319e95205Sopenharmony_ci * @tc.name: DiscoverServices 16419e95205Sopenharmony_ci*/ 16519e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_DiscoverServices, TestSize.Level1) 16619e95205Sopenharmony_ci{ 16719e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_DiscoverServices start"; 16819e95205Sopenharmony_ci BluetoothRemoteDevice device; 16919e95205Sopenharmony_ci GattClient client(device); 17019e95205Sopenharmony_ci GattClientCallbackTest callback_; 17119e95205Sopenharmony_ci bool isAutoConnect = true; 17219e95205Sopenharmony_ci int transport = 1; 17319e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 17419e95205Sopenharmony_ci int result = client.DiscoverServices(); 17519e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 17619e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_DiscoverServices end"; 17719e95205Sopenharmony_ci} 17819e95205Sopenharmony_ci 17919e95205Sopenharmony_ci/* 18019e95205Sopenharmony_ci * @tc.number: GattClient005 18119e95205Sopenharmony_ci * @tc.name: GetService_1 18219e95205Sopenharmony_ci*/ 18319e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_GetService_1, TestSize.Level1) 18419e95205Sopenharmony_ci{ 18519e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_GetService_1 start"; 18619e95205Sopenharmony_ci BluetoothRemoteDevice device; 18719e95205Sopenharmony_ci GattClient client(device); 18819e95205Sopenharmony_ci GattClientCallbackTest callback_; 18919e95205Sopenharmony_ci bool isAutoConnect = true; 19019e95205Sopenharmony_ci int transport = 1; 19119e95205Sopenharmony_ci bool ret = false; 19219e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 19319e95205Sopenharmony_ci UUID id = UUID::RandomUUID(); 19419e95205Sopenharmony_ci client.GetService(id); 19519e95205Sopenharmony_ci if (client.GetService(id) != std::nullopt) { 19619e95205Sopenharmony_ci ret = true; 19719e95205Sopenharmony_ci } 19819e95205Sopenharmony_ci EXPECT_EQ(ret, false); 19919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_GetService_1 end"; 20019e95205Sopenharmony_ci} 20119e95205Sopenharmony_ci 20219e95205Sopenharmony_ci/* 20319e95205Sopenharmony_ci * @tc.number: GattClient006 20419e95205Sopenharmony_ci * @tc.name: GetService_2 20519e95205Sopenharmony_ci*/ 20619e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_GetService_2, TestSize.Level1) 20719e95205Sopenharmony_ci{ 20819e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_GetService_2 start"; 20919e95205Sopenharmony_ci BluetoothRemoteDevice device; 21019e95205Sopenharmony_ci GattClient client(device); 21119e95205Sopenharmony_ci GattClientCallbackTest callback_; 21219e95205Sopenharmony_ci bool isAutoConnect = true; 21319e95205Sopenharmony_ci int transport = 1; 21419e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 21519e95205Sopenharmony_ci EXPECT_EQ((int)client.GetService().size(), 0); 21619e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_GetService_2 end"; 21719e95205Sopenharmony_ci} 21819e95205Sopenharmony_ci 21919e95205Sopenharmony_ci/* 22019e95205Sopenharmony_ci * @tc.number: GattClient007 22119e95205Sopenharmony_ci * @tc.name: ReadCharacteristic 22219e95205Sopenharmony_ci*/ 22319e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_ReadCharacteristic, TestSize.Level1) 22419e95205Sopenharmony_ci{ 22519e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_ReadCharacteristic start"; 22619e95205Sopenharmony_ci BluetoothRemoteDevice device; 22719e95205Sopenharmony_ci GattClient client(device); 22819e95205Sopenharmony_ci GattClientCallbackTest callback_; 22919e95205Sopenharmony_ci bool isAutoConnect = true; 23019e95205Sopenharmony_ci int transport = 1; 23119e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 23219e95205Sopenharmony_ci UUID uuid_ = UUID::RandomUUID(); 23319e95205Sopenharmony_ci int permissions = 17; 23419e95205Sopenharmony_ci int properties = 37; 23519e95205Sopenharmony_ci GattCharacteristic characteristic = GattCharacteristic(uuid_, permissions, properties); 23619e95205Sopenharmony_ci int result = client.ReadCharacteristic(characteristic); 23719e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 23819e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_ReadCharacteristic end"; 23919e95205Sopenharmony_ci} 24019e95205Sopenharmony_ci 24119e95205Sopenharmony_ci/* 24219e95205Sopenharmony_ci * @tc.number: GattClient008 24319e95205Sopenharmony_ci * @tc.name: ReadDescriptor 24419e95205Sopenharmony_ci*/ 24519e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_ReadDescriptor, TestSize.Level1) 24619e95205Sopenharmony_ci{ 24719e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_ReadDescriptor start"; 24819e95205Sopenharmony_ci BluetoothRemoteDevice device; 24919e95205Sopenharmony_ci GattClient client(device); 25019e95205Sopenharmony_ci GattClientCallbackTest callback_; 25119e95205Sopenharmony_ci bool isAutoConnect = true; 25219e95205Sopenharmony_ci int transport = 1; 25319e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 25419e95205Sopenharmony_ci UUID uuid_ = UUID::RandomUUID(); 25519e95205Sopenharmony_ci int permissions = 17; 25619e95205Sopenharmony_ci GattDescriptor descriptor = GattDescriptor(uuid_, permissions); 25719e95205Sopenharmony_ci int result = client.ReadDescriptor(descriptor); 25819e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 25919e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_ReadDescriptor end"; 26019e95205Sopenharmony_ci} 26119e95205Sopenharmony_ci 26219e95205Sopenharmony_ci/* 26319e95205Sopenharmony_ci * @tc.number: GattClient009 26419e95205Sopenharmony_ci * @tc.name: RequestBleMtuSize 26519e95205Sopenharmony_ci*/ 26619e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_RequestBleMtuSize, TestSize.Level1) 26719e95205Sopenharmony_ci{ 26819e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_RequestBleMtuSize start"; 26919e95205Sopenharmony_ci BluetoothRemoteDevice device; 27019e95205Sopenharmony_ci GattClient client(device); 27119e95205Sopenharmony_ci GattClientCallbackTest callback_; 27219e95205Sopenharmony_ci bool isAutoConnect = true; 27319e95205Sopenharmony_ci int transport = 1; 27419e95205Sopenharmony_ci int result = client.Connect(callback_, isAutoConnect, transport); 27519e95205Sopenharmony_ci int mtu = 17; 27619e95205Sopenharmony_ci result = client.RequestBleMtuSize(mtu); 27719e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 27819e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_RequestBleMtuSize end"; 27919e95205Sopenharmony_ci} 28019e95205Sopenharmony_ci 28119e95205Sopenharmony_ci/* 28219e95205Sopenharmony_ci * @tc.number: GattClient010 28319e95205Sopenharmony_ci * @tc.name: SetNotifyCharacteristic 28419e95205Sopenharmony_ci*/ 28519e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_SetNotifyCharacteristic, TestSize.Level1) 28619e95205Sopenharmony_ci{ 28719e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_SetNotifyCharacteristic start"; 28819e95205Sopenharmony_ci BluetoothRemoteDevice device; 28919e95205Sopenharmony_ci GattClient client(device); 29019e95205Sopenharmony_ci GattClientCallbackTest callback_; 29119e95205Sopenharmony_ci bool isAutoConnect = true; 29219e95205Sopenharmony_ci int transport = 1; 29319e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 29419e95205Sopenharmony_ci UUID uuid_ = UUID::RandomUUID(); 29519e95205Sopenharmony_ci int permissions = 17; 29619e95205Sopenharmony_ci int properties = 37; 29719e95205Sopenharmony_ci GattCharacteristic characteristic = GattCharacteristic(uuid_, permissions, properties); 29819e95205Sopenharmony_ci bool enable = true; 29919e95205Sopenharmony_ci int result = client.SetNotifyCharacteristic(characteristic, enable); 30019e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 30119e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_SetNotifyCharacteristic end"; 30219e95205Sopenharmony_ci} 30319e95205Sopenharmony_ci 30419e95205Sopenharmony_ci/* 30519e95205Sopenharmony_ci * @tc.number: GattClient011 30619e95205Sopenharmony_ci * @tc.name: WriteCharacteristic 30719e95205Sopenharmony_ci*/ 30819e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_WriteCharacteristic, TestSize.Level1) 30919e95205Sopenharmony_ci{ 31019e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_WriteCharacteristic start"; 31119e95205Sopenharmony_ci BluetoothRemoteDevice device; 31219e95205Sopenharmony_ci GattClient client(device); 31319e95205Sopenharmony_ci GattClientCallbackTest callback_; 31419e95205Sopenharmony_ci bool isAutoConnect = true; 31519e95205Sopenharmony_ci int transport = 1; 31619e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 31719e95205Sopenharmony_ci UUID uuid_ = UUID::RandomUUID(); 31819e95205Sopenharmony_ci int permissions = 17; 31919e95205Sopenharmony_ci int properties = 37; 32019e95205Sopenharmony_ci GattCharacteristic characteristic = GattCharacteristic(uuid_, permissions, properties); 32119e95205Sopenharmony_ci int result = client.WriteCharacteristic(characteristic); 32219e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 32319e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_WriteCharacteristic end"; 32419e95205Sopenharmony_ci} 32519e95205Sopenharmony_ci 32619e95205Sopenharmony_ci/* 32719e95205Sopenharmony_ci * @tc.number: GattClient012 32819e95205Sopenharmony_ci * @tc.name: WriteDescriptor 32919e95205Sopenharmony_ci*/ 33019e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_WriteDescriptor, TestSize.Level1) 33119e95205Sopenharmony_ci{ 33219e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_WriteDescriptor start"; 33319e95205Sopenharmony_ci BluetoothRemoteDevice device; 33419e95205Sopenharmony_ci GattClient client(device); 33519e95205Sopenharmony_ci GattClientCallbackTest callback_; 33619e95205Sopenharmony_ci bool isAutoConnect = true; 33719e95205Sopenharmony_ci int transport = 1; 33819e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 33919e95205Sopenharmony_ci UUID uuid_ = UUID::RandomUUID(); 34019e95205Sopenharmony_ci int permissions = 17; 34119e95205Sopenharmony_ci GattDescriptor descriptor = GattDescriptor(uuid_, permissions); 34219e95205Sopenharmony_ci int result = client.WriteDescriptor(descriptor); 34319e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 34419e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_WriteDescriptor end"; 34519e95205Sopenharmony_ci} 34619e95205Sopenharmony_ci 34719e95205Sopenharmony_ci/* 34819e95205Sopenharmony_ci * @tc.number: GattClient013 34919e95205Sopenharmony_ci * @tc.name: RequestConnectionPriority 35019e95205Sopenharmony_ci*/ 35119e95205Sopenharmony_ciHWTEST_F(GattClientTest, GattClient_UnitTest_RequestConnectionPriority, TestSize.Level1) 35219e95205Sopenharmony_ci{ 35319e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_RequestConnectionPriority start"; 35419e95205Sopenharmony_ci BluetoothRemoteDevice device; 35519e95205Sopenharmony_ci GattClient client(device); 35619e95205Sopenharmony_ci GattClientCallbackTest callback_; 35719e95205Sopenharmony_ci bool isAutoConnect = true; 35819e95205Sopenharmony_ci int transport = 1; 35919e95205Sopenharmony_ci client.Connect(callback_, isAutoConnect, transport); 36019e95205Sopenharmony_ci int connPriority = 2; 36119e95205Sopenharmony_ci int result = client.RequestConnectionPriority(connPriority); 36219e95205Sopenharmony_ci EXPECT_NE(result, NO_ERROR); 36319e95205Sopenharmony_ci GTEST_LOG_(INFO) << "GattClient_UnitTest_RequestConnectionPriority end"; 36419e95205Sopenharmony_ci} 36519e95205Sopenharmony_ci 36619e95205Sopenharmony_ci} // namespace Bluetooth 36719e95205Sopenharmony_ci} // namespace OHOS 368