1 /* 2 * Copyright (C) 2021 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 "adapter_manager.h" 18 19 using namespace testing::ext; 20 using namespace OHOS::bluetooth; 21 22 namespace OHOS { 23 namespace Bluetooth { 24 25 class HostServerTest : public testing::Test { 26 public: HostServerTest()27 HostServerTest() 28 {} ~HostServerTest()29 ~HostServerTest() 30 {} 31 32 int tempData_ = 0; 33 static void SetUpTestCase(void); 34 static void TearDownTestCase(void); 35 void SetUp(); 36 void TearDown(); 37 }; 38 SetUpTestCase(void)39void HostServerTest::SetUpTestCase(void) 40 {} TearDownTestCase(void)41void HostServerTest::TearDownTestCase(void) 42 {} SetUp()43void HostServerTest::SetUp() 44 { 45 tempData_ = 0; 46 } 47 TearDown()48void HostServerTest::TearDown() 49 {} 50 51 // URI: scheme://authority/path1/path2/path3?id = 1&name = mingming&old#fragment 52 /** 53 * @tc.number: Xxx_Unittest_AttachId_GetId_0100 54 * @tc.name: AttachId/GetId 55 * @tc.desc: Test if attachd and getid return values are correct. 56 */ 57 HWTEST_F(HostServerTest, HostServer_ModuleTest_OnStateChanged, TestSize.Level1) 58 { 59 GTEST_LOG_(INFO) << "HostServer_ModuleTest_OnStateChanged start"; 60 61 AdapterManager::GetInstance()->Enable(BTTransport::ADAPTER_BREDR); 62 AdapterManager::GetInstance()->OnAdapterStateChange(BTTransport::ADAPTER_BREDR, BTStateID::STATE_TURN_OFF); 63 GTEST_LOG_(INFO) << "BluetoothHostServer::OnStateChanged ends"; 64 65 EXPECT_EQ(1000, 1000); 66 67 GTEST_LOG_(INFO) << "HostServer_ModuleTest_OnStateChanged end"; 68 } 69 70 } // namespace Bluetooth 71 } // namespace OHOS