• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "locator_skeleton_test.h"
17 
18 #include <cstdlib>
19 
20 #include "accesstoken_kit.h"
21 #include "bundle_mgr_interface.h"
22 #include "bundle_mgr_proxy.h"
23 #include "if_system_ability_manager.h"
24 #include "ipc_skeleton.h"
25 #include "iservice_registry.h"
26 #include "nativetoken_kit.h"
27 #include "system_ability_definition.h"
28 #include "token_setproc.h"
29 
30 #include "app_identity.h"
31 
32 #include "common_utils.h"
33 #include "constant_definition.h"
34 #include "i_locator.h"
35 #include "location.h"
36 #include "location_log.h"
37 #include "location_sa_load_manager.h"
38 #include "locator.h"
39 #define private public
40 #include "locator_skeleton.h"
41 #undef private
42 #ifdef FEATURE_GNSS_SUPPORT
43 #include "nmea_message_callback_napi.h"
44 #endif
45 #include "permission_manager.h"
46 #include "location_data_rdb_manager.h"
47 
48 using namespace testing::ext;
49 
50 namespace OHOS {
51 namespace Location {
52 const int32_t LOCATION_PERM_NUM = 5;
53 const std::string RUNNING_STATE_OBSERVER = "ohos.permission.RUNNING_STATE_OBSERVER";
SetUp()54 void LocatorSkeletonTest::SetUp()
55 {
56     /*
57      * @tc.setup: Get system ability's pointer and get sa proxy object.
58      */
59     LoadSystemAbility();
60     MockNativePermission();
61     MockNativeMockPermission();
62 }
63 
TearDown()64 void LocatorSkeletonTest::TearDown()
65 {
66 }
67 
LoadSystemAbility()68 void LocatorSkeletonTest::LoadSystemAbility()
69 {
70     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_LOCATOR_SA_ID);
71 #ifdef FEATURE_GNSS_SUPPORT
72     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_GNSS_SA_ID);
73 #endif
74 #ifdef FEATURE_PASSIVE_SUPPORT
75     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_NOPOWER_LOCATING_SA_ID);
76 #endif
77 #ifdef FEATURE_NETWORK_SUPPORT
78     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_NETWORK_LOCATING_SA_ID);
79 #endif
80 #ifdef FEATURE_GEOCODE_SUPPORT
81     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_GEO_CONVERT_SA_ID);
82 #endif
83 }
84 
MockNativePermission()85 void LocatorSkeletonTest::MockNativePermission()
86 {
87     const char *perms[] = {
88         ACCESS_LOCATION.c_str(), ACCESS_APPROXIMATELY_LOCATION.c_str(),
89         ACCESS_BACKGROUND_LOCATION.c_str(), MANAGE_SECURE_SETTINGS.c_str(),
90         RUNNING_STATE_OBSERVER.c_str(), ACCESS_MOCK_LOCATION.c_str(),
91     };
92     NativeTokenInfoParams infoInstance = {
93         .dcapsNum = 0,
94         .permsNum = LOCATION_PERM_NUM,
95         .aclsNum = 0,
96         .dcaps = nullptr,
97         .perms = perms,
98         .acls = nullptr,
99         .processName = "tddTestApkname01",
100         .aplStr = "system_basic",
101     };
102     tokenId_ = GetAccessTokenId(&infoInstance);
103     SetSelfTokenID(tokenId_);
104     Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
105 }
106 
MockNativeMockPermission()107 void LocatorSkeletonTest::MockNativeMockPermission()
108 {
109     const char *perms[] = {
110         ACCESS_LOCATION.c_str(), ACCESS_BACKGROUND_LOCATION.c_str(),
111         MANAGE_SECURE_SETTINGS.c_str(), RUNNING_STATE_OBSERVER.c_str(),
112         ACCESS_MOCK_LOCATION.c_str(),
113     };
114     NativeTokenInfoParams infoInstance = {
115         .dcapsNum = 0,
116         .permsNum = LOCATION_PERM_NUM,
117         .aclsNum = 0,
118         .dcaps = nullptr,
119         .perms = perms,
120         .acls = nullptr,
121         .processName = "tddTestApkname02",
122         .aplStr = "system_basic",
123     };
124     tokenId2_ = GetAccessTokenId(&infoInstance);
125     SetSelfTokenID(tokenId2_);
126     Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
127 }
128 
129 HWTEST_F(LocatorSkeletonTest, PreGetSwitchState, TestSize.Level1)
130 {
131     GTEST_LOG_(INFO)
132         << "LocatorSkeletonTest, PreGetSwitchState, TestSize.Level1";
133     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetSwitchState begin");
134     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
135     MessageParcel data;
136     MessageParcel reply;
137     AppIdentity identity;
138     identity.SetPid(1);
139     identity.SetUid(2);
140     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
141     identity.SetTokenId(tokenId);
142     identity.SetFirstTokenId(0);
143     identity.SetBundleName("bundleName");
144     auto result = locatorAbilityStub->PreGetSwitchState(data, reply, identity);
145     EXPECT_EQ(ERRCODE_SUCCESS, result);
146     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetSwitchState end");
147 }
148 
149 HWTEST_F(LocatorSkeletonTest, PreRegisterSwitchCallback, TestSize.Level1)
150 {
151     GTEST_LOG_(INFO)
152         << "LocatorSkeletonTest, PreRegisterSwitchCallback, TestSize.Level1";
153     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterSwitchCallback begin");
154     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
155     MessageParcel data;
156     MessageParcel reply;
157     AppIdentity identity;
158     identity.SetPid(1);
159     identity.SetUid(2);
160     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
161     identity.SetTokenId(tokenId);
162     identity.SetFirstTokenId(0);
163     identity.SetBundleName("bundleName");
164     auto result = locatorAbilityStub->PreRegisterSwitchCallback(data, reply, identity);
165     EXPECT_EQ(ERRCODE_SUCCESS, result);
166     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterSwitchCallback end");
167 }
168 
169 HWTEST_F(LocatorSkeletonTest, PreStartLocating, TestSize.Level1)
170 {
171     GTEST_LOG_(INFO)
172         << "LocatorSkeletonTest, PreStartLocating, TestSize.Level1";
173     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStartLocating begin");
174     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
175     MessageParcel data;
176     auto callback = sptr<LocatorCallbackNapi>(new (std::nothrow) LocatorCallbackNapi());
177     data.WriteInt32(1);
178     data.WriteInt32(1);
179     data.WriteInt32(1);
180     data.WriteDouble(1.0);
181     data.WriteFloat(1.0);
182     data.WriteInt32(1);
183     data.WriteInt32(1);
184     data.WriteRemoteObject(callback->AsObject());
185     MessageParcel reply;
186     AppIdentity identity;
187     locatorAbilityStub->PreStartLocating(data, reply, identity);
188     identity.SetPid(1);
189     identity.SetUid(2);
190     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
191     identity.SetTokenId(tokenId);
192     identity.SetFirstTokenId(0);
193     identity.SetBundleName("bundleName");
194     LocationDataRdbManager::SetSwitchStateToDb(ENABLED);
195     locatorAbilityStub->PreStartLocating(data, reply, identity);
196     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStartLocating end");
197 }
198 
199 HWTEST_F(LocatorSkeletonTest, PreStopLocating, TestSize.Level1)
200 {
201     GTEST_LOG_(INFO)
202         << "LocatorSkeletonTest, PreStopLocating, TestSize.Level1";
203     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStopLocating begin");
204     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
205     MessageParcel data;
206     auto callback = sptr<LocatorCallbackNapi>(new (std::nothrow) LocatorCallbackNapi());
207     data.WriteRemoteObject(callback->AsObject());
208     MessageParcel reply;
209     AppIdentity identity;
210     identity.SetPid(1);
211     identity.SetUid(2);
212     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
213     identity.SetTokenId(tokenId);
214     identity.SetFirstTokenId(0);
215     identity.SetBundleName("bundleName");
216     locatorAbilityStub->PreStopLocating(data, reply, identity);
217     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStopLocating end");
218 }
219 
220 HWTEST_F(LocatorSkeletonTest, PreGetCacheLocation, TestSize.Level1)
221 {
222     GTEST_LOG_(INFO)
223         << "LocatorSkeletonTest, PreGetCacheLocation, TestSize.Level1";
224     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetCacheLocation begin");
225     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
226     auto callback = sptr<LocatorCallbackNapi>(new (std::nothrow) LocatorCallbackNapi());
227     MessageParcel reply;
228     MessageParcel data;
229     data.WriteInt32(1);
230     data.WriteBool(true);
231     data.WriteRemoteObject(callback->AsObject());
232     AppIdentity identity;
233     identity.SetPid(1);
234     identity.SetUid(2);
235     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
236     identity.SetTokenId(tokenId);
237     identity.SetFirstTokenId(0);
238     identity.SetBundleName("bundleName");
239     LocationDataRdbManager::SetSwitchStateToDb(ENABLED);
240     locatorAbilityStub->PreGetCacheLocation(data, reply, identity);
241     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetCacheLocation end");
242 }
243 
244 HWTEST_F(LocatorSkeletonTest, PreEnableAbility, TestSize.Level1)
245 {
246     GTEST_LOG_(INFO)
247         << "LocatorSkeletonTest, PreEnableAbility, TestSize.Level1";
248     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreEnableAbility begin");
249     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
250     MessageParcel data;
251     MessageParcel reply;
252     AppIdentity identity;
253     locatorAbilityStub->PreEnableAbility(data, reply, identity);
254     auto callback = sptr<LocatorCallbackNapi>(new (std::nothrow) LocatorCallbackNapi());
255     data.WriteBool(true);
256     identity.SetPid(1);
257     identity.SetUid(2);
258     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
259     identity.SetTokenId(tokenId);
260     identity.SetFirstTokenId(0);
261     identity.SetBundleName("bundleName");
262     auto result = locatorAbilityStub->PreEnableAbility(data, reply, identity);
263     EXPECT_EQ(ERRCODE_SUCCESS, result);
264     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreEnableAbility end");
265 }
266 
267 HWTEST_F(LocatorSkeletonTest, PreUpdateSaAbility, TestSize.Level1)
268 {
269     GTEST_LOG_(INFO)
270         << "LocatorSkeletonTest, PreUpdateSaAbility, TestSize.Level1";
271     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUpdateSaAbility begin");
272     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
273     MessageParcel data;
274     MessageParcel reply;
275     AppIdentity identity;
276     locatorAbilityStub->PreUpdateSaAbility(data, reply, identity);
277     identity.SetPid(1);
278     identity.SetUid(2);
279     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
280     identity.SetTokenId(tokenId);
281     identity.SetFirstTokenId(0);
282     identity.SetBundleName("bundleName");
283     auto result = locatorAbilityStub->PreUpdateSaAbility(data, reply, identity);
284     EXPECT_EQ(ERRCODE_SUCCESS, result);
285     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUpdateSaAbility end");
286 }
287 
288 #ifdef FEATURE_GEOCODE_SUPPORT
289 HWTEST_F(LocatorSkeletonTest, PreIsGeoConvertAvailable, TestSize.Level1)
290 {
291     GTEST_LOG_(INFO)
292         << "LocatorSkeletonTest, PreIsGeoConvertAvailable, TestSize.Level1";
293     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreIsGeoConvertAvailable begin");
294     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
295     MessageParcel data;
296     MessageParcel reply;
297     AppIdentity identity;
298     locatorAbilityStub->PreIsGeoConvertAvailable(data, reply, identity);
299     identity.SetPid(1);
300     identity.SetUid(2);
301     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
302     identity.SetTokenId(tokenId);
303     identity.SetFirstTokenId(0);
304     identity.SetBundleName("bundleName");
305     auto result = locatorAbilityStub->PreIsGeoConvertAvailable(data, reply, identity);
306     EXPECT_EQ(ERRCODE_SUCCESS, result);
307     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreIsGeoConvertAvailable end");
308 }
309 #endif
310 
311 #ifdef FEATURE_GEOCODE_SUPPORT
312 HWTEST_F(LocatorSkeletonTest, PreGetAddressByCoordinate, TestSize.Level1)
313 {
314     GTEST_LOG_(INFO)
315         << "LocatorSkeletonTest, PreGetAddressByCoordinate, TestSize.Level1";
316     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetAddressByCoordinate begin");
317     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
318     MessageParcel data;
319     MessageParcel reply;
320     AppIdentity identity;
321     identity.SetPid(1);
322     identity.SetUid(2);
323     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
324     identity.SetTokenId(tokenId);
325     identity.SetFirstTokenId(0);
326     identity.SetBundleName("bundleName");
327     auto result = locatorAbilityStub->PreGetAddressByCoordinate(data, reply, identity);
328     EXPECT_EQ(ERRCODE_SUCCESS, result);
329     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetAddressByCoordinate end");
330 }
331 #endif
332 
333 #ifdef FEATURE_GEOCODE_SUPPORT
334 HWTEST_F(LocatorSkeletonTest, PreGetAddressByLocationName, TestSize.Level1)
335 {
336     GTEST_LOG_(INFO)
337         << "LocatorSkeletonTest, PreGetAddressByLocationName, TestSize.Level1";
338     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetAddressByLocationName begin");
339     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
340     MessageParcel data;
341     MessageParcel reply;
342     AppIdentity identity;
343     identity.SetPid(1);
344     identity.SetUid(2);
345     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
346     identity.SetTokenId(tokenId);
347     identity.SetFirstTokenId(0);
348     identity.SetBundleName("bundleName");
349     auto result = locatorAbilityStub->PreGetAddressByLocationName(data, reply, identity);
350     EXPECT_EQ(ERRCODE_SUCCESS, result);
351     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetAddressByLocationName end");
352 }
353 #endif
354 
355 #ifdef FEATURE_GEOCODE_SUPPORT
356 HWTEST_F(LocatorSkeletonTest, PreUnregisterSwitchCallback, TestSize.Level1)
357 {
358     GTEST_LOG_(INFO)
359         << "LocatorSkeletonTest, PreUnregisterSwitchCallback, TestSize.Level1";
360     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterSwitchCallback begin");
361     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
362     MessageParcel data;
363     MessageParcel reply;
364     AppIdentity identity;
365     identity.SetPid(1);
366     identity.SetUid(2);
367     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
368     identity.SetTokenId(tokenId);
369     identity.SetFirstTokenId(0);
370     identity.SetBundleName("bundleName");
371     auto result = locatorAbilityStub->PreUnregisterSwitchCallback(data, reply, identity);
372     EXPECT_EQ(ERRCODE_SUCCESS, result);
373     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterSwitchCallback end");
374 }
375 #endif
376 
377 #ifdef FEATURE_GNSS_SUPPORT
378 HWTEST_F(LocatorSkeletonTest, PreRegisterGnssStatusCallback, TestSize.Level1)
379 {
380     GTEST_LOG_(INFO)
381         << "LocatorSkeletonTest, PreRegisterGnssStatusCallback, TestSize.Level1";
382     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterGnssStatusCallback begin");
383     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
384     MessageParcel data;
385     MessageParcel reply;
386     AppIdentity identity;
387     locatorAbilityStub->PreRegisterGnssStatusCallback(data, reply, identity);
388     identity.SetPid(1);
389     identity.SetUid(2);
390     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
391     identity.SetTokenId(tokenId);
392     identity.SetFirstTokenId(0);
393     identity.SetBundleName("bundleName");
394     auto result = locatorAbilityStub->PreRegisterGnssStatusCallback(data, reply, identity);
395     EXPECT_EQ(ERRCODE_SUCCESS, result);
396     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterGnssStatusCallback end");
397 }
398 #endif
399 
400 #ifdef FEATURE_GNSS_SUPPORT
401 HWTEST_F(LocatorSkeletonTest, PreUnregisterGnssStatusCallback, TestSize.Level1)
402 {
403     GTEST_LOG_(INFO)
404         << "LocatorSkeletonTest, PreUnregisterGnssStatusCallback, TestSize.Level1";
405     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterGnssStatusCallback begin");
406     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
407     MessageParcel data;
408     MessageParcel reply;
409     AppIdentity identity;
410     locatorAbilityStub->PreRegisterGnssStatusCallback(data, reply, identity);
411     identity.SetPid(1);
412     identity.SetUid(2);
413     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
414     identity.SetTokenId(tokenId);
415     identity.SetFirstTokenId(0);
416     identity.SetBundleName("bundleName");
417     auto result = locatorAbilityStub->PreUnregisterGnssStatusCallback(data, reply, identity);
418     EXPECT_EQ(ERRCODE_SUCCESS, result);
419     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterGnssStatusCallback end");
420 }
421 #endif
422 
423 #ifdef FEATURE_GNSS_SUPPORT
424 HWTEST_F(LocatorSkeletonTest, PreRegisterNmeaMessageCallback, TestSize.Level1)
425 {
426     GTEST_LOG_(INFO)
427         << "LocatorSkeletonTest, PreRegisterNmeaMessageCallback, TestSize.Level1";
428     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterNmeaMessageCallback begin");
429     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
430     MessageParcel data;
431     MessageParcel reply;
432     AppIdentity identity;
433     locatorAbilityStub->PreRegisterGnssStatusCallback(data, reply, identity);
434     identity.SetPid(1);
435     identity.SetUid(2);
436     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
437     identity.SetTokenId(tokenId);
438     identity.SetFirstTokenId(0);
439     identity.SetBundleName("bundleName");
440     auto result = locatorAbilityStub->PreRegisterNmeaMessageCallback(data, reply, identity);
441     EXPECT_EQ(ERRCODE_SUCCESS, result);
442     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterNmeaMessageCallback end");
443 }
444 #endif
445 
446 #ifdef FEATURE_GNSS_SUPPORT
447 HWTEST_F(LocatorSkeletonTest, PreUnregisterNmeaMessageCallback, TestSize.Level1)
448 {
449     GTEST_LOG_(INFO)
450         << "LocatorSkeletonTest, PreUnregisterNmeaMessageCallback, TestSize.Level1";
451     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterNmeaMessageCallback begin");
452     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
453     MessageParcel data;
454     MessageParcel reply;
455     AppIdentity identity;
456     identity.SetPid(1);
457     identity.SetUid(2);
458     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
459     identity.SetTokenId(tokenId);
460     identity.SetFirstTokenId(0);
461     identity.SetBundleName("bundleName");
462     auto result = locatorAbilityStub->PreUnregisterNmeaMessageCallback(data, reply, identity);
463     EXPECT_EQ(ERRCODE_SUCCESS, result);
464     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterNmeaMessageCallback end");
465 }
466 #endif
467 
468 #ifdef FEATURE_GNSS_SUPPORT
469 HWTEST_F(LocatorSkeletonTest, PreRegisterNmeaMessageCallbackV9, TestSize.Level1)
470 {
471     GTEST_LOG_(INFO)
472         << "LocatorSkeletonTest, PreRegisterNmeaMessageCallbackV9, TestSize.Level1";
473     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterNmeaMessageCallbackV9 begin");
474     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
475     MessageParcel data;
476     MessageParcel reply;
477     AppIdentity identity;
478     locatorAbilityStub->PreRegisterNmeaMessageCallbackV9(data, reply, identity);
479     identity.SetPid(1);
480     identity.SetUid(2);
481     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
482     identity.SetTokenId(tokenId);
483     identity.SetFirstTokenId(0);
484     identity.SetBundleName("bundleName");
485     auto result = locatorAbilityStub->PreRegisterNmeaMessageCallbackV9(data, reply, identity);
486     EXPECT_EQ(ERRCODE_SUCCESS, result);
487     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterNmeaMessageCallbackV9 end");
488 }
489 #endif
490 
491 #ifdef FEATURE_GNSS_SUPPORT
492 HWTEST_F(LocatorSkeletonTest, PreUnregisterNmeaMessageCallbackV9, TestSize.Level1)
493 {
494     GTEST_LOG_(INFO)
495         << "LocatorSkeletonTest, PreUnregisterNmeaMessageCallbackV9, TestSize.Level1";
496     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterNmeaMessageCallbackV9 begin");
497     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
498     MessageParcel data;
499     MessageParcel reply;
500     AppIdentity identity;
501     locatorAbilityStub->PreUnregisterNmeaMessageCallbackV9(data, reply, identity);
502     identity.SetPid(1);
503     identity.SetUid(2);
504     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
505     identity.SetTokenId(tokenId);
506     identity.SetFirstTokenId(0);
507     identity.SetBundleName("bundleName");
508     auto result = locatorAbilityStub->PreUnregisterNmeaMessageCallbackV9(data, reply, identity);
509     EXPECT_EQ(ERRCODE_SUCCESS, result);
510     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterNmeaMessageCallbackV9 end");
511 }
512 #endif
513 
514 HWTEST_F(LocatorSkeletonTest, PreIsLocationPrivacyConfirmed, TestSize.Level1)
515 {
516     GTEST_LOG_(INFO)
517         << "LocatorSkeletonTest, PreIsLocationPrivacyConfirmed, TestSize.Level1";
518     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreIsLocationPrivacyConfirmed begin");
519     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
520     MessageParcel data;
521     MessageParcel reply;
522     AppIdentity identity;
523     locatorAbilityStub->PreIsLocationPrivacyConfirmed(data, reply, identity);
524     identity.SetPid(1);
525     identity.SetUid(2);
526     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
527     identity.SetTokenId(tokenId);
528     identity.SetFirstTokenId(0);
529     identity.SetBundleName("bundleName");
530     auto result = locatorAbilityStub->PreIsLocationPrivacyConfirmed(data, reply, identity);
531     EXPECT_EQ(ERRCODE_SUCCESS, result);
532     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreIsLocationPrivacyConfirmed end");
533 }
534 
535 HWTEST_F(LocatorSkeletonTest, PreSetLocationPrivacyConfirmStatus, TestSize.Level1)
536 {
537     GTEST_LOG_(INFO)
538         << "LocatorSkeletonTest, PreSetLocationPrivacyConfirmStatus, TestSize.Level1";
539     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSetLocationPrivacyConfirmStatus begin");
540     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
541     MessageParcel data;
542     MessageParcel reply;
543     AppIdentity identity;
544     locatorAbilityStub->PreSetLocationPrivacyConfirmStatus(data, reply, identity);
545     identity.SetPid(1);
546     identity.SetUid(2);
547     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
548     identity.SetTokenId(tokenId);
549     identity.SetFirstTokenId(0);
550     identity.SetBundleName("bundleName");
551     auto result = locatorAbilityStub->PreSetLocationPrivacyConfirmStatus(data, reply, identity);
552     EXPECT_EQ(ERRCODE_SUCCESS, result);
553     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSetLocationPrivacyConfirmStatus end");
554 }
555 
556 HWTEST_F(LocatorSkeletonTest, PreStartCacheLocating, TestSize.Level1)
557 {
558     GTEST_LOG_(INFO)
559         << "LocatorSkeletonTest, PreStartCacheLocating, TestSize.Level1";
560     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStartCacheLocating begin");
561     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
562     MessageParcel data;
563     MessageParcel reply;
564     AppIdentity identity;
565     auto callback = sptr<LocatorCallbackNapi>(new (std::nothrow) LocatorCallbackNapi());
566     identity.SetPid(1);
567     identity.SetUid(2);
568     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
569     identity.SetTokenId(tokenId);
570     identity.SetFirstTokenId(0);
571     identity.SetBundleName("bundleName");
572     data.WriteInt32(1);
573     data.WriteBool(true);
574     data.WriteRemoteObject(callback->AsObject());
575     locatorAbilityStub->PreStartCacheLocating(data, reply, identity);
576     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStartCacheLocating end");
577 }
578 
579 HWTEST_F(LocatorSkeletonTest, PreStopCacheLocating, TestSize.Level1)
580 {
581     GTEST_LOG_(INFO)
582         << "LocatorSkeletonTest, PreStopCacheLocating, TestSize.Level1";
583     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStopCacheLocating begin");
584     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
585     MessageParcel data;
586     MessageParcel reply;
587     AppIdentity identity;
588     identity.SetPid(1);
589     identity.SetUid(2);
590     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
591     identity.SetTokenId(tokenId);
592     identity.SetFirstTokenId(0);
593     identity.SetBundleName("bundleName");
594     auto callback = sptr<LocatorCallbackNapi>(new (std::nothrow) LocatorCallbackNapi());
595     data.WriteInt32(1);
596     data.WriteBool(true);
597     data.WriteRemoteObject(callback->AsObject());
598     locatorAbilityStub->PreStopCacheLocating(data, reply, identity);
599     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreStopCacheLocating end");
600 }
601 
602 HWTEST_F(LocatorSkeletonTest, PreGetCachedGnssLocationsSize, TestSize.Level1)
603 {
604     GTEST_LOG_(INFO)
605         << "LocatorSkeletonTest, PreGetCachedGnssLocationsSize, TestSize.Level1";
606     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetCachedGnssLocationsSize begin");
607     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
608     MessageParcel data;
609     MessageParcel reply;
610     AppIdentity identity;
611     locatorAbilityStub->PreGetCachedGnssLocationsSize(data, reply, identity);
612     identity.SetPid(1);
613     identity.SetUid(2);
614     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
615     identity.SetTokenId(tokenId);
616     identity.SetFirstTokenId(0);
617     identity.SetBundleName("bundleName");
618     auto result = locatorAbilityStub->PreGetCachedGnssLocationsSize(data, reply, identity);
619     EXPECT_EQ(ERRCODE_SUCCESS, result);
620     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreGetCachedGnssLocationsSize end");
621 }
622 
623 HWTEST_F(LocatorSkeletonTest, PreFlushCachedGnssLocations, TestSize.Level1)
624 {
625     GTEST_LOG_(INFO)
626         << "LocatorSkeletonTest, PreFlushCachedGnssLocations, TestSize.Level1";
627     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreFlushCachedGnssLocations begin");
628     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
629     MessageParcel data;
630     MessageParcel reply;
631     AppIdentity identity;
632     locatorAbilityStub->PreFlushCachedGnssLocations(data, reply, identity);
633     identity.SetPid(1);
634     identity.SetUid(2);
635     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
636     identity.SetTokenId(tokenId);
637     identity.SetFirstTokenId(0);
638     identity.SetBundleName("bundleName");
639     auto result = locatorAbilityStub->PreFlushCachedGnssLocations(data, reply, identity);
640     EXPECT_EQ(ERRCODE_SUCCESS, result);
641     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreFlushCachedGnssLocations end");
642 }
643 
644 HWTEST_F(LocatorSkeletonTest, PreSendCommand, TestSize.Level1)
645 {
646     GTEST_LOG_(INFO)
647         << "LocatorSkeletonTest, PreSendCommand, TestSize.Level1";
648     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSendCommand begin");
649     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
650     MessageParcel data;
651     MessageParcel reply;
652     AppIdentity identity;
653     locatorAbilityStub->PreSendCommand(data, reply, identity);
654     identity.SetPid(1);
655     identity.SetUid(2);
656     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
657     identity.SetTokenId(tokenId);
658     identity.SetFirstTokenId(0);
659     identity.SetBundleName("bundleName");
660     auto result = locatorAbilityStub->PreSendCommand(data, reply, identity);
661     EXPECT_EQ(ERRCODE_SUCCESS, result);
662     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSendCommand end");
663 }
664 
665 HWTEST_F(LocatorSkeletonTest, PreAddFence, TestSize.Level1)
666 {
667     GTEST_LOG_(INFO)
668         << "LocatorSkeletonTest, PreAddFence, TestSize.Level1";
669     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreAddFence begin");
670     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
671     MessageParcel data;
672     MessageParcel reply;
673     AppIdentity identity;
674     locatorAbilityStub->PreAddFence(data, reply, identity);
675     identity.SetPid(1);
676     identity.SetUid(2);
677     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
678     identity.SetTokenId(tokenId);
679     identity.SetFirstTokenId(0);
680     identity.SetBundleName("bundleName");
681     auto result = locatorAbilityStub->PreAddFence(data, reply, identity);
682     EXPECT_EQ(ERRCODE_SUCCESS, result);
683     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreAddFence end");
684 }
685 
686 
687 HWTEST_F(LocatorSkeletonTest, PreRemoveFence, TestSize.Level1)
688 {
689     GTEST_LOG_(INFO)
690         << "LocatorSkeletonTest, PreRemoveFence, TestSize.Level1";
691     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRemoveFence begin");
692     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
693     MessageParcel data;
694     MessageParcel reply;
695     AppIdentity identity;
696     identity.SetPid(1);
697     identity.SetUid(2);
698     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
699     identity.SetTokenId(tokenId);
700     identity.SetFirstTokenId(0);
701     identity.SetBundleName("bundleName");
702     auto result = locatorAbilityStub->PreRemoveFence(data, reply, identity);
703     EXPECT_EQ(ERRCODE_SUCCESS, result);
704     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRemoveFence end");
705 }
706 
707 HWTEST_F(LocatorSkeletonTest, PreAddGnssGeofence, TestSize.Level1)
708 {
709     GTEST_LOG_(INFO)
710         << "LocatorSkeletonTest, PreAddGnssGeofence, TestSize.Level1";
711     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreAddGnssGeofence begin");
712     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
713     MessageParcel data;
714     MessageParcel reply;
715     AppIdentity identity;
716     identity.SetPid(1);
717     identity.SetUid(2);
718     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
719     identity.SetTokenId(tokenId);
720     identity.SetFirstTokenId(0);
721     identity.SetBundleName("bundleName");
722     auto result = locatorAbilityStub->PreAddGnssGeofence(data, reply, identity);
723     EXPECT_EQ(ERRCODE_SUCCESS, result);
724     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreAddGnssGeofence end");
725 }
726 
727 HWTEST_F(LocatorSkeletonTest, PreRemoveGnssGeofence, TestSize.Level1)
728 {
729     GTEST_LOG_(INFO)
730         << "LocatorSkeletonTest, PreRemoveGnssGeofence, TestSize.Level1";
731     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRemoveGnssGeofence begin");
732     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
733     MessageParcel data;
734     MessageParcel reply;
735     AppIdentity identity;
736     identity.SetPid(1);
737     identity.SetUid(2);
738     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
739     identity.SetTokenId(tokenId);
740     identity.SetFirstTokenId(0);
741     identity.SetBundleName("bundleName");
742     auto result = locatorAbilityStub->PreRemoveGnssGeofence(data, reply, identity);
743     EXPECT_EQ(ERRCODE_SUCCESS, result);
744     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRemoveGnssGeofence end");
745 }
746 
747 HWTEST_F(LocatorSkeletonTest, PreEnableLocationMock, TestSize.Level1)
748 {
749     GTEST_LOG_(INFO)
750         << "LocatorSkeletonTest, PreEnableLocationMock, TestSize.Level1";
751     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreEnableLocationMock begin");
752     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
753     MessageParcel data;
754     MessageParcel reply;
755     AppIdentity identity;
756     identity.SetPid(1);
757     identity.SetUid(2);
758     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
759     identity.SetTokenId(tokenId);
760     identity.SetFirstTokenId(0);
761     identity.SetBundleName("bundleName");
762     locatorAbilityStub->PreEnableLocationMock(data, reply, identity);
763     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreEnableLocationMock end");
764 }
765 
766 HWTEST_F(LocatorSkeletonTest, PreDisableLocationMock, TestSize.Level1)
767 {
768     GTEST_LOG_(INFO)
769         << "LocatorSkeletonTest, PreDisableLocationMock, TestSize.Level1";
770     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreDisableLocationMock begin");
771     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
772     MessageParcel data;
773     MessageParcel reply;
774     AppIdentity identity;
775     identity.SetPid(1);
776     identity.SetUid(2);
777     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
778     identity.SetTokenId(tokenId);
779     identity.SetFirstTokenId(0);
780     identity.SetBundleName("bundleName");
781     locatorAbilityStub->PreDisableLocationMock(data, reply, identity);
782     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreDisableLocationMock end");
783 }
784 
785 HWTEST_F(LocatorSkeletonTest, PreSetMockedLocations, TestSize.Level1)
786 {
787     GTEST_LOG_(INFO)
788         << "LocatorSkeletonTest, PreSetMockedLocations, TestSize.Level1";
789     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSetMockedLocations begin");
790     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
791     MessageParcel data;
792     MessageParcel reply;
793     AppIdentity identity;
794     identity.SetPid(1);
795     identity.SetUid(2);
796     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
797     identity.SetTokenId(tokenId);
798     identity.SetFirstTokenId(0);
799     identity.SetBundleName("bundleName");
800     locatorAbilityStub->PreSetMockedLocations(data, reply, identity);
801     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSetMockedLocations end");
802 }
803 
804 HWTEST_F(LocatorSkeletonTest, PreEnableReverseGeocodingMock, TestSize.Level1)
805 {
806     GTEST_LOG_(INFO)
807         << "LocatorSkeletonTest, PreEnableReverseGeocodingMock, TestSize.Level1";
808     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreEnableReverseGeocodingMock begin");
809     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
810     MessageParcel data;
811     MessageParcel reply;
812     AppIdentity identity;
813     identity.SetPid(1);
814     identity.SetUid(2);
815     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
816     identity.SetTokenId(tokenId);
817     identity.SetFirstTokenId(0);
818     identity.SetBundleName("bundleName");
819     locatorAbilityStub->PreEnableReverseGeocodingMock(data, reply, identity);
820     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreEnableReverseGeocodingMock end");
821 }
822 
823 HWTEST_F(LocatorSkeletonTest, PreDisableReverseGeocodingMock, TestSize.Level1)
824 {
825     GTEST_LOG_(INFO)
826         << "LocatorSkeletonTest, PreDisableReverseGeocodingMock, TestSize.Level1";
827     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreDisableReverseGeocodingMock begin");
828     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
829     MessageParcel data;
830     MessageParcel reply;
831     AppIdentity identity;
832     identity.SetPid(1);
833     identity.SetUid(2);
834     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
835     identity.SetTokenId(tokenId);
836     identity.SetFirstTokenId(0);
837     identity.SetBundleName("bundleName");
838     locatorAbilityStub->PreDisableReverseGeocodingMock(data, reply, identity);
839     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreDisableReverseGeocodingMock end");
840 }
841 
842 HWTEST_F(LocatorSkeletonTest, PreSetReverseGeocodingMockInfo, TestSize.Level1)
843 {
844     GTEST_LOG_(INFO)
845         << "LocatorSkeletonTest, PreSetReverseGeocodingMockInfo, TestSize.Level1";
846     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSetReverseGeocodingMockInfo begin");
847     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
848     MessageParcel data;
849     MessageParcel reply;
850     AppIdentity identity;
851     identity.SetPid(1);
852     identity.SetUid(2);
853     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
854     identity.SetTokenId(tokenId);
855     identity.SetFirstTokenId(0);
856     identity.SetBundleName("bundleName");
857     locatorAbilityStub->PreSetReverseGeocodingMockInfo(data, reply, identity);
858     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreSetReverseGeocodingMockInfo end");
859 }
860 
861 HWTEST_F(LocatorSkeletonTest, PreProxyForFreeze, TestSize.Level1)
862 {
863     GTEST_LOG_(INFO)
864         << "LocatorSkeletonTest, PreProxyForFreeze, TestSize.Level1";
865     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreProxyForFreeze begin");
866     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
867     MessageParcel data;
868     MessageParcel reply;
869     AppIdentity identity;
870     identity.SetPid(1);
871     identity.SetUid(2);
872     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
873     identity.SetTokenId(tokenId);
874     identity.SetFirstTokenId(0);
875     identity.SetBundleName("bundleName");
876     locatorAbilityStub->PreProxyForFreeze(data, reply, identity);
877     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreProxyForFreeze end");
878 }
879 
880 HWTEST_F(LocatorSkeletonTest, PreResetAllProxy, TestSize.Level1)
881 {
882     GTEST_LOG_(INFO)
883         << "LocatorSkeletonTest, PreResetAllProxy, TestSize.Level1";
884     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreResetAllProxy begin");
885     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
886     MessageParcel data;
887     MessageParcel reply;
888     AppIdentity identity;
889     identity.SetPid(1);
890     identity.SetUid(2);
891     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
892     identity.SetTokenId(tokenId);
893     identity.SetFirstTokenId(0);
894     identity.SetBundleName("bundleName");
895     locatorAbilityStub->PreResetAllProxy(data, reply, identity);
896     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreResetAllProxy end");
897 }
898 
899 HWTEST_F(LocatorSkeletonTest, PreReportLocation, TestSize.Level1)
900 {
901     GTEST_LOG_(INFO)
902         << "LocatorSkeletonTest, PreReportLocation, TestSize.Level1";
903     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreReportLocation begin");
904     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
905     MessageParcel data;
906     MessageParcel reply;
907     AppIdentity identity;
908     identity.SetPid(1);
909     identity.SetUid(2);
910     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
911     identity.SetTokenId(tokenId);
912     identity.SetFirstTokenId(0);
913     identity.SetBundleName("bundleName");
914     auto result = locatorAbilityStub->PreReportLocation(data, reply, identity);
915     EXPECT_EQ(ERRCODE_SUCCESS, result);
916     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreReportLocation end");
917 }
918 
919 HWTEST_F(LocatorSkeletonTest, PreRegisterLocatingRequiredDataCallback, TestSize.Level1)
920 {
921     GTEST_LOG_(INFO)
922         << "LocatorSkeletonTest, PreRegisterLocatingRequiredDataCallback, TestSize.Level1";
923     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterLocatingRequiredDataCallback begin");
924     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
925     MessageParcel data;
926     MessageParcel reply;
927     AppIdentity identity;
928     identity.SetPid(1);
929     identity.SetUid(2);
930     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
931     identity.SetTokenId(tokenId);
932     identity.SetFirstTokenId(0);
933     identity.SetBundleName("bundleName");
934     locatorAbilityStub->PreRegisterLocatingRequiredDataCallback(data, reply, identity);
935     locatorAbilityStub->PreUnregisterLocatingRequiredDataCallback(data, reply, identity);
936     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterLocatingRequiredDataCallback end");
937 }
938 
939 HWTEST_F(LocatorSkeletonTest, PreUnregisterLocatingRequiredDataCallback, TestSize.Level1)
940 {
941     GTEST_LOG_(INFO)
942         << "LocatorSkeletonTest, PreUnregisterLocatingRequiredDataCallback, TestSize.Level1";
943     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterLocatingRequiredDataCallback begin");
944     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
945     MessageParcel data;
946     MessageParcel reply;
947     AppIdentity identity;
948     identity.SetPid(1);
949     identity.SetUid(2);
950     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
951     identity.SetTokenId(tokenId);
952     identity.SetFirstTokenId(0);
953     identity.SetBundleName("bundleName");
954     locatorAbilityStub->PreUnregisterLocatingRequiredDataCallback(data, reply, identity);
955     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterLocatingRequiredDataCallback end");
956 }
957 
958 HWTEST_F(LocatorSkeletonTest, PreQuerySupportCoordinateSystemType, TestSize.Level1)
959 {
960     GTEST_LOG_(INFO)
961         << "LocatorSkeletonTest, PreQuerySupportCoordinateSystemType, TestSize.Level1";
962     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreQuerySupportCoordinateSystemType begin");
963     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
964     MessageParcel data;
965     MessageParcel reply;
966     AppIdentity identity;
967     identity.SetPid(1);
968     identity.SetUid(2);
969     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
970     identity.SetTokenId(tokenId);
971     identity.SetFirstTokenId(0);
972     identity.SetBundleName("bundleName");
973     locatorAbilityStub->PreQuerySupportCoordinateSystemType(data, reply, identity);
974     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreQuerySupportCoordinateSystemType end");
975 }
976 
977 HWTEST_F(LocatorSkeletonTest, PreRegisterLocationError, TestSize.Level1)
978 {
979     GTEST_LOG_(INFO)
980         << "LocatorSkeletonTest, PreRegisterLocationError, TestSize.Level1";
981     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterLocationError begin");
982     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
983     MessageParcel data;
984     MessageParcel reply;
985     AppIdentity identity;
986     identity.SetPid(1);
987     identity.SetUid(2);
988     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
989     identity.SetTokenId(tokenId);
990     identity.SetFirstTokenId(0);
991     identity.SetBundleName("bundleName");
992     LocationDataRdbManager::SetSwitchStateToDb(ENABLED);
993     locatorAbilityStub->PreRegisterLocationError(data, reply, identity);
994     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreRegisterLocationError end");
995 }
996 
997 HWTEST_F(LocatorSkeletonTest, PreUnregisterLocationError, TestSize.Level1)
998 {
999     GTEST_LOG_(INFO)
1000         << "LocatorSkeletonTest, PreUnregisterLocationError, TestSize.Level1";
1001     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterLocationError begin");
1002 
1003     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
1004     MessageParcel data;
1005     MessageParcel reply;
1006     AppIdentity identity;
1007     identity.SetPid(1);
1008     identity.SetUid(2);
1009     uint32_t tokenId = static_cast<uint32_t>(tokenId2_);
1010     identity.SetTokenId(tokenId);
1011     identity.SetFirstTokenId(0);
1012     identity.SetBundleName("bundleName");
1013     locatorAbilityStub->PreUnregisterLocationError(data, reply, identity);
1014     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreUnregisterLocationError end");
1015 }
1016 
1017 HWTEST_F(LocatorSkeletonTest, PreReportLocationError, TestSize.Level1)
1018 {
1019     GTEST_LOG_(INFO)
1020         << "LocatorSkeletonTest, PreReportLocationError, TestSize.Level1";
1021     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreReportLocationError begin");
1022     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
1023     MessageParcel data;
1024 
1025     MessageParcel reply;
1026     AppIdentity identity;
1027     identity.SetPid(1);
1028     identity.SetUid(2);
1029     uint32_t tokenId = static_cast<uint32_t>(tokenId_);
1030     identity.SetTokenId(tokenId);
1031     identity.SetFirstTokenId(0);
1032     identity.SetBundleName("bundleName");
1033     auto result = locatorAbilityStub->PreReportLocationError(data, reply, identity);
1034     EXPECT_EQ(ERRCODE_SUCCESS, result);
1035     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PreReportLocationError end");
1036 }
1037 
1038 HWTEST_F(LocatorSkeletonTest, OnRemoteRequest, TestSize.Level1)
1039 {
1040     GTEST_LOG_(INFO)
1041         << "LocatorSkeletonTest, OnRemoteRequest, TestSize.Level1";
1042     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] OnRemoteRequest begin");
1043     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
1044     MessageParcel data;
1045     data.WriteInterfaceToken(LocatorProxy::GetDescriptor());
1046     MessageParcel reply;
1047     MessageOption option;
1048     locatorAbilityStub->OnRemoteRequest(3, data, reply, option);
1049     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] OnRemoteRequest end");
1050 }
1051 
1052 HWTEST_F(LocatorSkeletonTest, RemoveUnloadTask, TestSize.Level1)
1053 {
1054     GTEST_LOG_(INFO)
1055         << "LocatorSkeletonTest, RemoveUnloadTask TestSize.Level1";
1056     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] RemoveUnloadTask begin");
1057     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
1058     locatorAbilityStub->RemoveUnloadTask(3);
1059     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] RemoveUnloadTask end");
1060 }
1061 
1062 HWTEST_F(LocatorSkeletonTest, PostUnloadTask, TestSize.Level1)
1063 {
1064     GTEST_LOG_(INFO)
1065         << "LocatorSkeletonTest, PostUnloadTask, TestSize.Level1";
1066     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PostUnloadTask begin");
1067     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
1068     locatorAbilityStub->PostUnloadTask(3);
1069     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PostUnloadTask end");
1070 }
1071 
1072 HWTEST_F(LocatorSkeletonTest, WriteLocationDenyReportEvent, TestSize.Level1)
1073 {
1074     GTEST_LOG_(INFO)
1075         << "LocatorSkeletonTest, WriteLocationDenyReportEvent TestSize.Level1";
1076     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] WriteLocationDenyReportEvent begin");
1077     MessageParcel data;
1078     data.WriteInterfaceToken(LocatorProxy::GetDescriptor());
1079     AppIdentity identity;
1080     auto locatorAbilityStub = sptr<MockLocatorAbilityStub>(new (std::nothrow) MockLocatorAbilityStub());
1081     locatorAbilityStub->WriteLocationDenyReportEvent(0, 0, data, identity);
1082     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] WriteLocationDenyReportEvent end");
1083 }
1084 
1085 HWTEST_F(LocatorSkeletonTest, OnRemoteDied, TestSize.Level1)
1086 {
1087     GTEST_LOG_(INFO)
1088         << "LocatorSkeletonTest, OnRemoteDied TestSize.Level1";
1089     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] OnRemoteDied begin");
1090     const wptr<IRemoteObject> remote;
1091     auto switchCallbackDeathRecipient =
1092         sptr<SwitchCallbackDeathRecipient>(new (std::nothrow) SwitchCallbackDeathRecipient());
1093     switchCallbackDeathRecipient->OnRemoteDied(remote);
1094     LBSLOGI(LOCATOR, "[LocatorSkeletonTest] PostUnloadTask end");
1095 }
1096 }  // namespace Location
1097 }  // namespace OHOS
1098