1 /* 2 * Copyright (c) 2025 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 <fcntl.h> 17 #include <gtest/gtest.h> 18 #include <string> 19 #include <thread> 20 21 #include "system_ability_definition.h" 22 23 #include "miscdevice_service.h" 24 #include "sensors_errors.h" 25 26 #undef LOG_TAG 27 #define LOG_TAG "VibratorServiceTest" 28 29 namespace OHOS { 30 namespace Sensors { 31 using namespace testing::ext; 32 33 namespace { 34 auto g_miscdeviceService = MiscdeviceDelayedSpSingleton<MiscdeviceService>::GetInstance(); 35 } 36 37 class VibratorServiceTest : public testing::Test { 38 public: 39 static void SetUpTestCase(); 40 static void TearDownTestCase(); 41 void SetUp(); 42 void TearDown(); 43 }; 44 SetUpTestCase()45void VibratorServiceTest::SetUpTestCase() 46 { 47 } 48 TearDownTestCase()49void VibratorServiceTest::TearDownTestCase() 50 { 51 } 52 SetUp()53void VibratorServiceTest::SetUp() 54 { 55 } 56 TearDown()57void VibratorServiceTest::TearDown() 58 { 59 } 60 61 HWTEST_F(VibratorServiceTest, OnAddSystemAbilityTest_001, TestSize.Level1) 62 { 63 MISC_HILOGI("OnAddSystemAbilityTest_001 in"); 64 std::string deviceId = "0"; 65 ASSERT_NE(g_miscdeviceService, nullptr); 66 g_miscdeviceService->isVibrationPriorityReady_ = true; 67 EXPECT_NO_FATAL_FAILURE(g_miscdeviceService->OnAddSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID, deviceId)); 68 } 69 } // namespace Sensors 70 } // namespace OHOS