1 /* 2 * Copyright (c) 2022 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 <string> 18 #include <vector> 19 #include "cmd_utils.h" 20 #include "datetime_manager_proxy.h" 21 22 using namespace testing::ext; 23 24 namespace OHOS { 25 namespace EDM { 26 namespace TEST { 27 class DatetimeManagerProxyTest : public testing::Test { 28 protected: 29 void SetUp() override; 30 31 void TearDown() override; 32 33 std::shared_ptr<DatetimeManagerProxy> dateTimeManagerProxy; 34 }; 35 SetUp()36void DatetimeManagerProxyTest::SetUp() 37 { 38 dateTimeManagerProxy = DatetimeManagerProxy::GetDatetimeManagerProxy(); 39 } 40 TearDown()41void DatetimeManagerProxyTest::TearDown() 42 { 43 if (dateTimeManagerProxy) { 44 dateTimeManagerProxy.reset(); 45 } 46 } 47 48 /** 49 * @tc.name: TestSetDateTime 50 * @tc.desc: Test SetDateTime func. 51 * @tc.type: FUNC 52 */ 53 HWTEST_F(DatetimeManagerProxyTest, TestSetDateTime, TestSize.Level1) 54 { 55 AppExecFwk::ElementName admin; 56 admin.SetBundleName("com.edm.test.demo"); 57 admin.SetAbilityName("com.edm.test.demo.Ability"); 58 int64_t time = 1674365400000; 59 int32_t ret = dateTimeManagerProxy->SetDateTime(admin, time); 60 EXPECT_TRUE(ret != ERR_OK); 61 } 62 } // namespace TEST 63 } // namespace EDM 64 } // namespace OHOS 65