• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "gnss_utils_test.h"
17 #include "gnss_interface_impl.h"
18 #include "string_ex.h"
19 
20 using namespace testing::ext;
21 namespace OHOS {
22 namespace HDI {
23 namespace Location {
24 namespace Gnss {
25 namespace V1_0 {
26 
SetUp()27 void GnssUtilsTest::SetUp()
28 {
29     auto gnssInstance_ = GnssInterfaceImplGetInstance();
30 }
31 
TearDown()32 void GnssUtilsTest::TearDown()
33 {
34     gnssInstance_ = nullptr;
35 }
36 
37 HWTEST_F(GnssUtilsTest, SetGnssReferenceInfoTest001, TestSize.Level1)
38 {
39     GTEST_LOG_(INFO)
40         << "GnssUtilsTest, SetGnssReferenceInfoTest001, TestSize.Level1";
41     EXPECT_NE(nullptr, gnssInstance_);
42     if (gnssInstance_ != nullptr) {
43         int32_t ret = gnssInstance_->SetGnssReferenceInfo();
44         EXPECT_EQ(HDF_SUCCESS, ret);
45     }
46 }
47 
48 HWTEST_F(GnssUtilsTest, SetPredictGnssDataTest001, TestSize.Level1)
49 {
50     GTEST_LOG_(INFO)
51         << "GnssUtilsTest, SetPredictGnssDataTest001, TestSize.Level1";
52     EXPECT_NE(nullptr, gnssInstance_);
53     if (gnssInstance_ != nullptr) {
54         int32_t ret = gnssInstance_->SetPredictGnssData();
55         EXPECT_EQ(HDF_SUCCESS, ret);
56     }
57 }
58 
59 HWTEST_F(GnssUtilsTest, GetCachedGnssLocationsSizeTest001, TestSize.Level1)
60 {
61     GTEST_LOG_(INFO)
62         << "GnssUtilsTest, GetCachedGnssLocationsSizeTest001, TestSize.Level1";
63     EXPECT_NE(nullptr, gnssInstance_);
64     if (gnssInstance_ != nullptr) {
65         int32_t ret = gnssInstance_->GetCachedGnssLocationsSize();
66         EXPECT_EQ(HDF_SUCCESS, ret);
67     }
68 }
69 
70 HWTEST_F(GnssUtilsTest, EnableGnssTest001, TestSize.Level1)
71 {
72     GTEST_LOG_(INFO)
73         << "GnssUtilsTest, EnableGnssTest001, TestSize.Level1";
74     EXPECT_NE(nullptr, gnssInstance_);
75     int32_t ret = gnssInstance_->StartGnss(GnssStartType::GNSS_START_TYPE_NORMAL);
76     EXPECT_EQ(HDF_SUCCESS, ret);
77 }
78 } // V1_0
79 } // Gnss
80 } // Location
81 } // HDI
82 } // OHOS
83