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 <cstdlib> 17 #include <ctime> 18 #include <chrono> 19 #include <fstream> 20 #include <gtest/gtest.h> 21 #include "time_common.h" 22 #include "time_permission.h" 23 24 namespace { 25 using namespace testing::ext; 26 using namespace OHOS; 27 using namespace OHOS::MiscServices; 28 using namespace std::chrono; 29 30 class TimePermissionTest : public testing::Test { 31 public: 32 static void SetUpTestCase(void); 33 34 static void TearDownTestCase(void); 35 36 void SetUp(); 37 38 void TearDown(); 39 }; 40 SetUpTestCase(void)41void TimePermissionTest::SetUpTestCase(void) { 42 } 43 TearDownTestCase(void)44void TimePermissionTest::TearDownTestCase(void) { 45 } 46 SetUp(void)47void TimePermissionTest::SetUp(void) { 48 } 49 TearDown(void)50void TimePermissionTest::TearDown(void) { 51 } 52 53 /** 54 * @tc.name: CheckCallingPermission001 55 * @tc.desc: check calling permission 56 * @tc.type: FUNC 57 */ 58 HWTEST_F(TimePermissionTest, CheckCallingPermission001, TestSize.Level1) 59 { 60 std::string permissionName(""); 61 bool ret = TimePermission::CheckCallingPermission(permissionName); 62 EXPECT_EQ(false, ret); 63 64 bool ret1 = TimePermission::CheckCallingPermission("permissionName"); 65 EXPECT_EQ(false, ret1); 66 } 67 68 }