• 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 "locator_ability_test.h"
17 #include <cstdlib>
18 
19 #define private public
20 #include "request.h"
21 #include "request_config.h"
22 #undef private
23 
24 #include "event_handler.h"
25 #include "event_runner.h"
26 #include "common_utils.h"
27 #include "constant_definition.h"
28 #include "country_code.h"
29 #include "country_code_callback_host.h"
30 #include "accesstoken_kit.h"
31 #include "nativetoken_kit.h"
32 #include "token_setproc.h"
33 #include "locator.h"
34 #include "permission_manager.h"
35 #include "report_manager.h"
36 
37 #ifdef FEATURE_GNSS_SUPPORT
38 #include "cached_locations_callback_napi.h"
39 #endif
40 #ifdef FEATURE_GEOCODE_SUPPORT
41 #include "geo_address.h"
42 #endif
43 #ifdef FEATURE_GNSS_SUPPORT
44 #include "gnss_status_callback_napi.h"
45 #endif
46 #include "i_locator.h"
47 #include "location.h"
48 #include "location_log.h"
49 #include "location_sa_load_manager.h"
50 #include "location_switch_callback_host.h"
51 #include "locator.h"
52 #include "locator_callback_host.h"
53 #include "locator_callback_proxy.h"
54 #include "locator_skeleton.h"
55 #ifdef FEATURE_GNSS_SUPPORT
56 #include "nmea_message_callback_napi.h"
57 #endif
58 #include "permission_manager.h"
59 #include "geofence_request.h"
60 #include "accesstoken_kit.h"
61 #include "bundle_mgr_interface.h"
62 #include "bundle_mgr_proxy.h"
63 #include "if_system_ability_manager.h"
64 #include "ipc_skeleton.h"
65 #include "iservice_registry.h"
66 #include "nativetoken_kit.h"
67 #include "system_ability_definition.h"
68 #include "token_setproc.h"
69 #include "request_manager.h"
70 #include "app_identity.h"
71 
72 #define private public
73 #include "locator_ability.h"
74 #undef private
75 
76 
77 using namespace testing::ext;
78 namespace OHOS {
79 namespace Location {
80 const uint32_t EVENT_SEND_SWITCHSTATE_TO_HIFENCE = 0x0006;
81 const int32_t LOCATION_PERM_NUM = 4;
82 const std::string ARGS_HELP = "-h";
SetUp()83 void LocatorAbilityTest::SetUp()
84 {
85     LoadSystemAbility();
86     MockNativePermission();
87 }
88 
TearDown()89 void LocatorAbilityTest::TearDown()
90 {
91 }
92 
LoadSystemAbility()93 void LocatorAbilityTest::LoadSystemAbility()
94 {
95     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_LOCATOR_SA_ID);
96 #ifdef FEATURE_GNSS_SUPPORT
97     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_GNSS_SA_ID);
98 #endif
99 #ifdef FEATURE_PASSIVE_SUPPORT
100     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_NOPOWER_LOCATING_SA_ID);
101 #endif
102 #ifdef FEATURE_NETWORK_SUPPORT
103     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_NETWORK_LOCATING_SA_ID);
104 #endif
105 #ifdef FEATURE_GEOCODE_SUPPORT
106     LocationSaLoadManager::GetInstance()->LoadLocationSa(LOCATION_GEO_CONVERT_SA_ID);
107 #endif
108 }
109 
MockNativePermission()110 void LocatorAbilityTest::MockNativePermission()
111 {
112     const char *perms[] = {
113         ACCESS_LOCATION.c_str(), ACCESS_APPROXIMATELY_LOCATION.c_str(),
114         ACCESS_BACKGROUND_LOCATION.c_str(), MANAGE_SECURE_SETTINGS.c_str(),
115     };
116     NativeTokenInfoParams infoInstance = {
117         .dcapsNum = 0,
118         .permsNum = LOCATION_PERM_NUM,
119         .aclsNum = 0,
120         .dcaps = nullptr,
121         .perms = perms,
122         .acls = nullptr,
123         .processName = "LocatorAbilityTest",
124         .aplStr = "system_basic",
125     };
126     tokenId_ = GetAccessTokenId(&infoInstance);
127     SetSelfTokenID(tokenId_);
128     Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
129 }
130 
131 HWTEST_F(LocatorAbilityTest, LocatorAbilityApplyRequestsTest001, TestSize.Level1)
132 {
133     GTEST_LOG_(INFO)
134         << "LocatorAbilityTest, LocatorAbilityApplyRequestsTest001, TestSize.Level1";
135     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityApplyRequestsTest001 begin");
136     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
137     int delay = 1;
138     locatorAbility->ApplyRequests(delay);
139     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityApplyRequestsTest001 end");
140 }
141 
142 HWTEST_F(LocatorAbilityTest, LocatorAbilityUpdateSaAbilityTest001, TestSize.Level1)
143 {
144     GTEST_LOG_(INFO)
145         << "LocatorAbilityTest, LocatorAbilityUpdateSaAbilityTest001, TestSize.Level1";
146     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUpdateSaAbilityTest001 begin");
147     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
148     locatorAbility->UpdateSaAbility();
149     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUpdateSaAbilityTest001 end");
150 }
151 
152 HWTEST_F(LocatorAbilityTest, LocatorAbilityRemoveUnloadTaskTest001, TestSize.Level1)
153 {
154     GTEST_LOG_(INFO)
155         << "LocatorAbilityTest, LocatorAbilityRemoveUnloadTaskTest001, TestSize.Level1";
156     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRemoveUnloadTask001 begin");
157     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
158     int code = 1;
159     locatorAbility->RemoveUnloadTask(code);
160     locatorAbility->RemoveUnloadTask(code);
161     code = static_cast<uint16_t>(LocatorInterfaceCode::PROXY_PID_FOR_FREEZE);
162     locatorAbility->RemoveUnloadTask(code);
163     code = static_cast<uint16_t>(LocatorInterfaceCode::RESET_ALL_PROXY);
164     locatorAbility->RemoveUnloadTask(code);
165     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRemoveUnloadTaskTest001 end");
166 }
167 
168 #ifdef FEATURE_GNSS_SUPPORT
169 HWTEST_F(LocatorAbilityTest, LocatorAbilityAddGnssGeofence001, TestSize.Level1)
170 {
171     GTEST_LOG_(INFO)
172         << "LocatorAbilityTest, LocatorAbilityAddGnssGeofence001, TestSize.Level1";
173     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityAddGnssGeofence001 begin");
174     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
175     std::shared_ptr<GeofenceRequest> request = std::make_shared<GeofenceRequest>();
176     locatorAbility->AddGnssGeofence(request);
177     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityAddGnssGeofence001 end");
178 }
179 #endif
180 
181 HWTEST_F(LocatorAbilityTest, LocatorAbilityAddGnssGeofence002, TestSize.Level1)
182 {
183     GTEST_LOG_(INFO)
184         << "LocatorAbilityTest, LocatorAbilityAddGnssGeofence002, TestSize.Level1";
185     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityAddGnssGeofence002 begin");
186     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
187     std::shared_ptr<GeofenceRequest> request = std::make_shared<GeofenceRequest>();
188     locatorAbility->AddGnssGeofence(request);
189     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityAddGnssGeofence002 end");
190 }
191 
192 #ifdef FEATURE_GNSS_SUPPORT
193 HWTEST_F(LocatorAbilityTest, LocatorAbilityRemoveGnssGeofence001, TestSize.Level1)
194 {
195     GTEST_LOG_(INFO)
196         << "LocatorAbilityTest, LocatorAbilityRemoveGnssGeofence001, TestSize.Level1";
197     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRemoveGnssGeofence001 begin");
198     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
199     std::shared_ptr<GeofenceRequest> request = std::make_shared<GeofenceRequest>();
200     locatorAbility->RemoveGnssGeofence(request);
201     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRemoveGnssGeofence001 end");
202 }
203 #endif
204 
205 HWTEST_F(LocatorAbilityTest, LocatorAbilityRemoveGnssGeofence002, TestSize.Level1)
206 {
207     GTEST_LOG_(INFO)
208         << "LocatorAbilityTest, LocatorAbilityRemoveGnssGeofence002, TestSize.Level1";
209     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRemoveGnssGeofence002 begin");
210     auto locatorAbility = sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
211     std::shared_ptr<GeofenceRequest> request = std::make_shared<GeofenceRequest>();
212     locatorAbility->AddGnssGeofence(request);
213     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRemoveGnssGeofence002 end");
214 }
215 
216 HWTEST_F(LocatorAbilityTest, LocatorAbilityStartLocating001, TestSize.Level1)
217 {
218     GTEST_LOG_(INFO)
219         << "LocatorAbilityTest, LocatorAbilityStartLocating001, TestSize.Level1";
220     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityStartLocating001 begin");
221     auto locatorAbility =
222         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
223     locatorAbility->proxyMap_ = std::make_shared<std::map<std::string, sptr<IRemoteObject>>>();
224     std::unique_ptr<RequestConfig> requestConfig = std::make_unique<RequestConfig>();
225     sptr<ILocatorCallback> callbackStub = new (std::nothrow) LocatorCallbackStub();
226     AppIdentity identity;
227     locatorAbility->StartLocating(requestConfig, callbackStub, identity);
228     sptr<IRemoteObject> objectGnss = CommonUtils::GetRemoteObject(LOCATION_GNSS_SA_ID, CommonUtils::InitDeviceId());
229     locatorAbility->proxyMap_->insert(make_pair(GNSS_ABILITY, objectGnss));
230     locatorAbility->reportManager_ = ReportManager::GetInstance();
231     locatorAbility->requestManager_ = RequestManager::GetInstance();
232     locatorAbility->StartLocating(requestConfig, callbackStub, identity);
233     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityStartLocating001 end");
234 }
235 
236 HWTEST_F(LocatorAbilityTest, LocatorAbilityIsCacheVaildScenario001, TestSize.Level1)
237 {
238     GTEST_LOG_(INFO)
239         << "LocatorAbilityTest, LocatorAbilityIsCacheVaildScenario001, TestSize.Level1";
240     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityIsCacheVaildScenario001 begin");
241     auto locatorAbility =
242         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
243     std::unique_ptr<RequestConfig> requestConfig = std::make_unique<RequestConfig>();
244     AppIdentity identity;
245     std::shared_ptr<Request> request = std::make_shared<Request>();
246     request->requestConfig_->scenario_ = SCENE_UNSET;
247     request->requestConfig_->priority_ = PRIORITY_LOW_POWER;
248     bool res = locatorAbility->IsCacheVaildScenario(request->GetRequestConfig());
249     EXPECT_EQ(true, res);
250     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityIsCacheVaildScenario001 end");
251 }
252 
253 HWTEST_F(LocatorAbilityTest, LocatorAbilityIsCacheVaildScenario002, TestSize.Level1)
254 {
255     GTEST_LOG_(INFO)
256         << "LocatorAbilityTest, LocatorAbilityIsCacheVaildScenario002, TestSize.Level1";
257     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityIsCacheVaildScenario002 begin");
258     auto locatorAbility =
259         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
260     std::unique_ptr<RequestConfig> requestConfig = std::make_unique<RequestConfig>();
261     AppIdentity identity;
262     std::shared_ptr<Request> request = std::make_shared<Request>();
263     request->requestConfig_->scenario_ = SCENE_UNSET;
264     request->requestConfig_->priority_ = LOCATION_PRIORITY_ACCURACY;
265     bool res = locatorAbility->IsCacheVaildScenario(request->GetRequestConfig());
266     EXPECT_EQ(false, res);
267     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityIsCacheVaildScenario002 end");
268 }
269 
270 HWTEST_F(LocatorAbilityTest, LocatorAbilityIsSingleRequest001, TestSize.Level1)
271 {
272     GTEST_LOG_(INFO)
273         << "LocatorAbilityTest, LocatorAbilityIsSingleRequest001, TestSize.Level1";
274     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityIsSingleRequest001 begin");
275     auto locatorAbility =
276         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
277     std::unique_ptr<RequestConfig> requestConfig = std::make_unique<RequestConfig>();
278     AppIdentity identity;
279     std::shared_ptr<Request> request = std::make_shared<Request>();
280     request->requestConfig_->fixNumber_ = 1;
281     bool res = locatorAbility->IsSingleRequest(request->GetRequestConfig());
282     EXPECT_EQ(true, res);
283     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityIsSingleRequest001 end");
284 }
285 
286 HWTEST_F(LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation001, TestSize.Level1)
287 {
288     GTEST_LOG_(INFO)
289         << "LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation001, TestSize.Level1";
290     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation001 begin");
291     auto locatorAbility =
292         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
293     sptr<ILocatorCallback> callback;
294     std::shared_ptr<Request> request = nullptr;
295     locatorAbility->reportManager_ = nullptr;
296     locatorAbility->NeedReportCacheLocation(request, callback);
297     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation001 end");
298 }
299 
300 HWTEST_F(LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation002, TestSize.Level1)
301 {
302     GTEST_LOG_(INFO)
303         << "LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation002, TestSize.Level1";
304     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation002 begin");
305     auto locatorAbility =
306         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
307     sptr<ILocatorCallback> callback;
308     std::shared_ptr<Request> request = std::make_shared<Request>();
309     locatorAbility->reportManager_ = ReportManager::GetInstance();
310     request->requestConfig_->fixNumber_ = 1;
311     request->requestConfig_->scenario_ = SCENE_DAILY_LIFE_SERVICE;
312     locatorAbility->NeedReportCacheLocation(request, callback);
313     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation002 end");
314 }
315 
316 HWTEST_F(LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation003, TestSize.Level1)
317 {
318     GTEST_LOG_(INFO)
319         << "LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation003, TestSize.Level1";
320     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation003 begin");
321     auto locatorAbility =
322         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
323     sptr<ILocatorCallback> callback;
324     std::shared_ptr<Request> request = std::make_shared<Request>();
325     locatorAbility->reportManager_ = ReportManager::GetInstance();
326     request->requestConfig_->fixNumber_ = 0;
327     request->requestConfig_->scenario_ = SCENE_DAILY_LIFE_SERVICE;
328     locatorAbility->NeedReportCacheLocation(request, callback);
329     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation003 end");
330 }
331 
332 HWTEST_F(LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation004, TestSize.Level1)
333 {
334     GTEST_LOG_(INFO)
335         << "LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation004, TestSize.Level1";
336     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation004 begin");
337     auto locatorAbility =
338         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
339     sptr<ILocatorCallback> callback;
340     std::shared_ptr<Request> request = std::make_shared<Request>();
341     locatorAbility->reportManager_ = ReportManager::GetInstance();
342     request->requestConfig_->fixNumber_ = 0;
343     request->requestConfig_->scenario_ = LOCATION_PRIORITY_ACCURACY;
344     locatorAbility->NeedReportCacheLocation(request, callback);
345     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation004 end");
346 }
347 
348 HWTEST_F(LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation005, TestSize.Level1)
349 {
350     GTEST_LOG_(INFO)
351         << "LocatorAbilityTest, LocatorAbilityNeedReportCacheLocation005, TestSize.Level1";
352     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation005 begin");
353     auto locatorAbility =
354         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
355     sptr<ILocatorCallback> callback;
356     std::shared_ptr<Request> request = std::make_shared<Request>();
357     locatorAbility->reportManager_ = ReportManager::GetInstance();
358     request->requestConfig_->fixNumber_ = 1;
359     request->requestConfig_->scenario_ = LOCATION_PRIORITY_ACCURACY;
360     locatorAbility->NeedReportCacheLocation(request, callback);
361     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityNeedReportCacheLocation005 end");
362 }
363 
364 HWTEST_F(LocatorAbilityTest, LocatorAbilityHandleStartLocating001, TestSize.Level1)
365 {
366     GTEST_LOG_(INFO)
367         << "LocatorAbilityTest, LocatorAbilityHandleStartLocating001, TestSize.Level1";
368     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityHandleStartLocating001 begin");
369     auto locatorAbility =
370         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
371     std::shared_ptr<Request> request = std::make_shared<Request>();
372     sptr<LocatorCallbackHost> locatorCallbackHost =
373         sptr<LocatorCallbackHost>(new (std::nothrow)LocatorCallbackHost());
374     sptr<ILocatorCallback> callback = sptr<ILocatorCallback>(locatorCallbackHost);
375     request->SetLocatorCallBack(callback);
376     locatorAbility->HandleStartLocating(request, callback);
377     locatorAbility->HandleStartLocating(request, callback);
378     locatorAbility->locatorHandler_->TaskCancelAndWait();
379     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityHandleStartLocating001 end");
380 }
381 
382 HWTEST_F(LocatorAbilityTest, LocatorAbilityStopLocating001, TestSize.Level1)
383 {
384     GTEST_LOG_(INFO)
385         << "LocatorAbilityTest, LocatorAbilityStopLocating001, TestSize.Level1";
386     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityStopLocating001 begin");
387     auto locatorAbility =
388         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
389     sptr<ILocatorCallback> callback;
390     locatorAbility->requestManager_ = nullptr;
391     locatorAbility->StopLocating(callback);
392     locatorAbility->requestManager_ = RequestManager::GetInstance();
393     locatorAbility->StopLocating(callback);
394     locatorAbility->StopLocating(callback);
395     locatorAbility->locatorHandler_->TaskCancelAndWait();
396     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityStopLocating001 end");
397 }
398 
399 HWTEST_F(LocatorAbilityTest, LocatorAbilityGetCacheLocation001, TestSize.Level1)
400 {
401     GTEST_LOG_(INFO)
402         << "LocatorAbilityTest, LocatorAbilityGetCacheLocation001, TestSize.Level1";
403     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityGetCacheLocation001 begin");
404     auto locatorAbility =
405         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
406     std::unique_ptr<Location> loc;
407     AppIdentity identity;
408     locatorAbility->GetCacheLocation(loc, identity);
409     locatorAbility->GetCacheLocation(loc, identity);
410     locatorAbility->locatorHandler_->TaskCancelAndWait();
411     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityGetCacheLocation001 end");
412 }
413 
414 HWTEST_F(LocatorAbilityTest, LocatorAbilityEnableReverseGeocodingMock001, TestSize.Level1)
415 {
416     GTEST_LOG_(INFO)
417         << "LocatorAbilityTest, LocatorAbilityEnableReverseGeocodingMock001, TestSize.Level1";
418     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityEnableReverseGeocodingMock001 begin");
419     auto locatorAbility =
420         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
421     locatorAbility->EnableReverseGeocodingMock();
422     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityEnableReverseGeocodingMock001 end");
423 }
424 
425 #ifdef FEATURE_GEOCODE_SUPPORT
426 HWTEST_F(LocatorAbilityTest, LocatorAbilityEnableReverseGeocodingMock002, TestSize.Level1)
427 {
428     GTEST_LOG_(INFO)
429         << "LocatorAbilityTest, LocatorAbilityEnableReverseGeocodingMock002, TestSize.Level1";
430     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityEnableReverseGeocodingMock002 begin");
431     auto locatorAbility =
432         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
433     locatorAbility->EnableReverseGeocodingMock();
434     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityEnableReverseGeocodingMock002 end");
435 }
436 #endif
437 
438 HWTEST_F(LocatorAbilityTest, LocatorAbilityDisableReverseGeocodingMock001, TestSize.Level1)
439 {
440     GTEST_LOG_(INFO)
441         << "LocatorAbilityTest, LocatorAbilityDisableReverseGeocodingMock001, TestSize.Level1";
442     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityDisableReverseGeocodingMock001 begin");
443     auto locatorAbility =
444         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
445     locatorAbility->DisableReverseGeocodingMock();
446     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityDisableReverseGeocodingMock001 end");
447 }
448 
449 #ifdef FEATURE_GEOCODE_SUPPORT
450 HWTEST_F(LocatorAbilityTest, LocatorAbilityDisableReverseGeocodingMock002, TestSize.Level1)
451 {
452     GTEST_LOG_(INFO)
453         << "LocatorAbilityTest, LocatorAbilityDisableReverseGeocodingMock002, TestSize.Level1";
454     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityDisableReverseGeocodingMock002 begin");
455     auto locatorAbility =
456         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
457     locatorAbility->DisableReverseGeocodingMock();
458     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityDisableReverseGeocodingMock002 end");
459 }
460 #endif
461 
462 HWTEST_F(LocatorAbilityTest, LocatorAbilitySetReverseGeocodingMockInfo001, TestSize.Level1)
463 {
464     GTEST_LOG_(INFO)
465         << "LocatorAbilityTest, LocatorAbilitySetReverseGeocodingMockInfo001, TestSize.Level1";
466     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySetReverseGeocodingMockInfo001 begin");
467     auto locatorAbility =
468         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
469     std::vector<std::shared_ptr<GeocodingMockInfo>> mockInfo;
470     locatorAbility->SetReverseGeocodingMockInfo(mockInfo);
471     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySetReverseGeocodingMockInfo001 end");
472 }
473 
474 #ifdef FEATURE_GEOCODE_SUPPORT
475 HWTEST_F(LocatorAbilityTest, LocatorAbilitySetReverseGeocodingMockInfo002, TestSize.Level1)
476 {
477     GTEST_LOG_(INFO)
478         << "LocatorAbilityTest, LocatorAbilitySetReverseGeocodingMockInfo002, TestSize.Level1";
479     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySetReverseGeocodingMockInfo002 begin");
480     auto locatorAbility =
481         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
482     std::vector<std::shared_ptr<GeocodingMockInfo>> mockInfo;
483     locatorAbility->SetReverseGeocodingMockInfo(mockInfo);
484     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySetReverseGeocodingMockInfo002 end");
485 }
486 #endif
487 
488 HWTEST_F(LocatorAbilityTest, LocatorAbilityRegisterPermissionCallback001, TestSize.Level1)
489 {
490     GTEST_LOG_(INFO)
491         << "LocatorAbilityTest, LocatorAbilityRegisterPermissionCallback001, TestSize.Level1";
492     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRegisterPermissionCallback001 begin");
493     auto locatorAbility =
494         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
495     auto permissionMap =
496         std::make_shared<std::map<uint32_t, std::shared_ptr<PermissionStatusChangeCb>>>();
497     locatorAbility->permissionMap_ = permissionMap;
498     uint32_t callingTokenId = 10;
499     std::vector<std::string> permissionNameList;
500     locatorAbility->RegisterPermissionCallback(callingTokenId, permissionNameList);
501     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRegisterPermissionCallback001 end");
502 }
503 
504 HWTEST_F(LocatorAbilityTest, LocatorAbilityUnRegisterPermissionCallback001, TestSize.Level1)
505 {
506     GTEST_LOG_(INFO)
507         << "LocatorAbilityTest, LocatorAbilityUnRegisterPermissionCallback001, TestSize.Level1";
508     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUnRegisterPermissionCallback001 begin");
509     auto locatorAbility =
510         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
511     auto permissionMap =
512         std::make_shared<std::map<uint32_t, std::shared_ptr<PermissionStatusChangeCb>>>();
513     locatorAbility->permissionMap_ = permissionMap;
514     uint32_t callingTokenId = 10;
515     std::vector<std::string> permissionNameList;
516     locatorAbility->UnregisterPermissionCallback(callingTokenId);
517     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUnRegisterPermissionCallback001 end");
518 }
519 
520 HWTEST_F(LocatorAbilityTest, LocatorAbilityReportDataToResSched001, TestSize.Level1)
521 {
522     GTEST_LOG_(INFO)
523         << "LocatorAbilityTest, LocatorAbilityReportDataToResSched001, TestSize.Level1";
524     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityReportDataToResSched001 begin");
525     auto locatorAbility =
526         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
527     std::string state("state");
528     locatorAbility->ReportDataToResSched(state);
529     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityReportDataToResSched001 end");
530 }
531 
532 HWTEST_F(LocatorAbilityTest, LocatorAbilityUpdateLastLocationRequestNum001, TestSize.Level1)
533 {
534     GTEST_LOG_(INFO)
535         << "LocatorAbilityTest, LocatorAbilityUpdateLastLocationRequestNum001, TestSize.Level1";
536     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUpdateLastLocationRequestNum001 begin");
537     auto locatorAbility =
538         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
539     locatorAbility->UpdateLastLocationRequestNum();
540     locatorAbility->UpdateLastLocationRequestNum();
541     locatorAbility->locatorHandler_->TaskCancelAndWait();
542     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUpdateLastLocationRequestNum001 end");
543 }
544 
545 HWTEST_F(LocatorAbilityTest, LocatorAbilitySendNetworkLocation001, TestSize.Level1)
546 {
547     GTEST_LOG_(INFO)
548         << "LocatorAbilityTest, LocatorAbilitySendNetworkLocation001, TestSize.Level1";
549     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySendNetworkLocation001 begin");
550     auto locatorAbility =
551         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
552     std::unique_ptr<Location> location = std::make_unique<Location>();
553     locatorAbility->SendNetworkLocation(location);
554     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySendNetworkLocation001 end");
555 }
556 
557 HWTEST_F(LocatorAbilityTest, LocatorAbilityRegisterLocationError001, TestSize.Level1)
558 {
559     GTEST_LOG_(INFO)
560         << "LocatorAbilityTest, LocatorAbilityRegisterLocationError001, TestSize.Level1";
561     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRegisterLocationError001 begin");
562     auto locatorAbility =
563         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
564     sptr<ILocatorCallback> callback;
565     AppIdentity identity;
566     locatorAbility->RegisterLocationError(callback, identity);
567     locatorAbility->UnregisterLocationError(callback, identity);
568     locatorAbility->RegisterLocationError(callback, identity);
569     locatorAbility->UnregisterLocationError(callback, identity);
570     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityRegisterLocationError001 end");
571 }
572 
573 HWTEST_F(LocatorAbilityTest, LocatorAbilityReportLocationError001, TestSize.Level1)
574 {
575     GTEST_LOG_(INFO)
576         << "LocatorAbilityTest, LocatorAbilityReportLocationError001, TestSize.Level1";
577     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityReportLocationError001 begin");
578     auto locatorAbility =
579         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
580     std::string uuid;
581     int32_t errCode = 10;
582     locatorAbility->ReportLocationError(uuid, errCode);
583     locatorAbility->ReportLocationError(uuid, errCode);
584     locatorAbility->locatorHandler_->TaskCancelAndWait();
585     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilityUnRegisterLocationError001 end");
586 }
587 
588 HWTEST_F(LocatorAbilityTest, LocatorAbilitySyncIdleState001, TestSize.Level1)
589 {
590     GTEST_LOG_(INFO)
591         << "LocatorAbilityTest, LocatorAbilitySyncIdleState001, TestSize.Level1";
592     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySyncIdleState001 begin");
593     auto locatorAbility =
594         sptr<LocatorAbility>(new (std::nothrow) LocatorAbility());
595     bool state = true;
596     locatorAbility->SyncIdleState(state);
597     state = false;
598     locatorAbility->SyncIdleState(state);
599     locatorAbility->locatorHandler_->TaskCancelAndWait();
600     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorAbilitySyncIdleState001 end");
601 }
602 
603 HWTEST_F(LocatorAbilityTest, LocationMessageGetAbilityName001, TestSize.Level1)
604 {
605     GTEST_LOG_(INFO)
606         << "LocatorAbilityTest, LocationMessageGetAbilityName001, TestSize.Level1";
607     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocationMessageGetAbilityName001 begin");
608     auto locationMessage =
609         new (std::nothrow) LocationMessage();
610     locationMessage->GetAbilityName();
611     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocationMessageGetAbilityName001 end");
612 }
613 
614 HWTEST_F(LocatorAbilityTest, LocationMessageSetLocation001, TestSize.Level1)
615 {
616     GTEST_LOG_(INFO)
617         << "LocatorAbilityTest, LocationMessageSetLocation001, TestSize.Level1";
618     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocationMessageSetLocation001 begin");
619     auto locationMessage =
620         new (std::nothrow) LocationMessage();
621     locationMessage->location_ = nullptr;
622     std::unique_ptr<Location> location;
623     locationMessage->SetLocation(location);
624     location = std::make_unique<Location>();
625     locationMessage->SetLocation(location);
626     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocationMessageSetLocation001 end");
627 }
628 
629 HWTEST_F(LocatorAbilityTest, LocationMessageGetLocation001, TestSize.Level1)
630 {
631     GTEST_LOG_(INFO)
632         << "LocatorAbilityTest, LocationMessageGetLocation001, TestSize.Level1";
633     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocationMessageGetLocation001 begin");
634     auto locationMessage =
635         new (std::nothrow) LocationMessage();
636     locationMessage->location_ = nullptr;
637     locationMessage->GetLocation();
638     locationMessage->location_ = std::make_unique<Location>();
639     locationMessage->GetLocation();
640     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocationMessageGetLocation001 end");
641 }
642 
643 HWTEST_F(LocatorAbilityTest, LocatorHandlerInitLocatorHandlerEventMap001, TestSize.Level1)
644 {
645     GTEST_LOG_(INFO)
646         << "LocatorAbilityTest, LocatorHandlerInitLocatorHandlerEventMap001, TestSize.Level1";
647     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerInitLocatorHandlerEventMap001 begin");
648     std::shared_ptr<AppExecFwk::EventRunner> runner;
649     auto locatorHandler =
650         new (std::nothrow) LocatorHandler(runner);
651     locatorHandler->InitLocatorHandlerEventMap();
652     locatorHandler->InitLocatorHandlerEventMap();
653     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerInitLocatorHandlerEventMap001 end");
654 }
655 
656 HWTEST_F(LocatorAbilityTest, LocatorHandlerGetCachedLocationSuccess001, TestSize.Level1)
657 {
658     GTEST_LOG_(INFO)
659         << "LocatorAbilityTest, LocatorHandlerGetCachedLocationSuccess001, TestSize.Level1";
660     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerGetCachedLocationSuccess001 begin");
661     std::shared_ptr<AppExecFwk::EventRunner> runner;
662     auto locatorHandler =
663         new (std::nothrow) LocatorHandler(runner);
664     int state = 1;
665     AppExecFwk::InnerEvent::Pointer event  =
666         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
667     locatorHandler->GetCachedLocationSuccess(event);
668     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerGetCachedLocationSuccess001 end");
669 }
670 
671 HWTEST_F(LocatorAbilityTest, LocatorHandlerGetCachedLocationFailed001, TestSize.Level1)
672 {
673     GTEST_LOG_(INFO)
674         << "LocatorAbilityTest, LocatorHandlerGetCachedLocationFailed001, TestSize.Level1";
675     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerGetCachedLocationFailed001 begin");
676     std::shared_ptr<AppExecFwk::EventRunner> runner;
677     auto locatorHandler =
678         new (std::nothrow) LocatorHandler(runner);
679     int state = 1;
680     AppExecFwk::InnerEvent::Pointer event  =
681         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
682     locatorHandler->GetCachedLocationFailed(event);
683     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerGetCachedLocationFailed001 end");
684 }
685 
686 HWTEST_F(LocatorAbilityTest, LocatorHandlerUpdateSaEvent001, TestSize.Level1)
687 {
688     GTEST_LOG_(INFO)
689         << "LocatorAbilityTest, LocatorHandlerUpdateSaEvent001, TestSize.Level1";
690     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerUpdateSaEvent001 begin");
691     std::shared_ptr<AppExecFwk::EventRunner> runner;
692     auto locatorHandler =
693         new (std::nothrow) LocatorHandler(runner);
694     int state = 1;
695     AppExecFwk::InnerEvent::Pointer event  =
696         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
697     locatorHandler->UpdateSaEvent(event);
698     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerUpdateSaEvent001 end");
699 }
700 
701 HWTEST_F(LocatorAbilityTest, LocatorHandlerApplyRequirementsEvent001, TestSize.Level1)
702 {
703     GTEST_LOG_(INFO)
704         << "LocatorAbilityTest, LocatorHandlerApplyRequirementsEvent001, TestSize.Level1";
705     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerApplyRequirementsEvent001 begin");
706     std::shared_ptr<AppExecFwk::EventRunner> runner;
707     auto locatorHandler =
708         new (std::nothrow) LocatorHandler(runner);
709     int state = 1;
710     AppExecFwk::InnerEvent::Pointer event  =
711         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
712     locatorHandler->ApplyRequirementsEvent(event);
713     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerApplyRequirementsEvent001 end");
714 }
715 
716 HWTEST_F(LocatorAbilityTest, LocatorHandlerRetryRegisterActionEvent001, TestSize.Level1)
717 {
718     GTEST_LOG_(INFO)
719         << "LocatorAbilityTest, LocatorHandlerRetryRegisterActionEvent001, TestSize.Level1";
720     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerRetryRegisterActionEvent001 begin");
721     std::shared_ptr<AppExecFwk::EventRunner> runner;
722     auto locatorHandler =
723         new (std::nothrow) LocatorHandler(runner);
724     int state = 1;
725     AppExecFwk::InnerEvent::Pointer event  =
726         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
727     locatorHandler->RetryRegisterActionEvent(event);
728     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerRetryRegisterActionEvent001 end");
729 }
730 
731 HWTEST_F(LocatorAbilityTest, LocatorHandlerReportLocationMessageEvent001, TestSize.Level1)
732 {
733     GTEST_LOG_(INFO)
734         << "LocatorAbilityTest, LocatorHandlerReportLocationMessageEvent001, TestSize.Level1";
735     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerReportLocationMessageEvent001 begin");
736     std::shared_ptr<AppExecFwk::EventRunner> runner;
737     auto locatorHandler =
738         new (std::nothrow) LocatorHandler(runner);
739     int state = 1;
740     AppExecFwk::InnerEvent::Pointer event  =
741         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
742     locatorHandler->ReportLocationMessageEvent(event);
743     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerReportLocationMessageEvent001 end");
744 }
745 
746 HWTEST_F(LocatorAbilityTest, LocatorHandlerStartAndStopLocatingEvent001, TestSize.Level1)
747 {
748     GTEST_LOG_(INFO)
749         << "LocatorAbilityTest, LocatorHandlerStartLocatingEvent001, TestSize.Level1";
750     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerStartLocatingEvent001 begin");
751     std::shared_ptr<AppExecFwk::EventRunner> runner;
752     auto locatorHandler =
753         new (std::nothrow) LocatorHandler(runner);
754     int state = 1;
755     AppExecFwk::InnerEvent::Pointer event  =
756         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
757     locatorHandler->StartLocatingEvent(event);
758     locatorHandler->StopLocatingEvent(event);
759     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerStartLocatingEvent001 end");
760 }
761 
762 HWTEST_F(LocatorAbilityTest, LocatorHandlerUpdateLastLocationRequestNum001, TestSize.Level1)
763 {
764     GTEST_LOG_(INFO)
765         << "LocatorAbilityTest, LocatorHandlerUpdateLastLocationRequestNum001, TestSize.Level1";
766     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerUpdateLastLocationRequestNum001 begin");
767     std::shared_ptr<AppExecFwk::EventRunner> runner;
768     auto locatorHandler =
769         new (std::nothrow) LocatorHandler(runner);
770     int state = 1;
771     AppExecFwk::InnerEvent::Pointer event  =
772         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
773     locatorHandler->UpdateLastLocationRequestNum(event);
774     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerUpdateLastLocationRequestNum001 end");
775 }
776 
777 HWTEST_F(LocatorAbilityTest, LocatorHandlerUnloadSaEvent001, TestSize.Level1)
778 {
779     GTEST_LOG_(INFO)
780         << "LocatorAbilityTest, LocatorHandlerUnloadSaEvent001, TestSize.Level1";
781     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerUnloadSaEvent001 begin");
782     std::shared_ptr<AppExecFwk::EventRunner> runner;
783     auto locatorHandler =
784         new (std::nothrow) LocatorHandler(runner);
785     int state = 1;
786     AppExecFwk::InnerEvent::Pointer event  =
787         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
788     locatorHandler->UnloadSaEvent(event);
789     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandlerUnloadSaEvent001 end");
790 }
791 
792 HWTEST_F(LocatorAbilityTest, LocatorHandler001, TestSize.Level1)
793 {
794     GTEST_LOG_(INFO)
795         << "LocatorAbilityTest, LocatorHandler001, TestSize.Level1";
796     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandler001 begin");
797     std::shared_ptr<AppExecFwk::EventRunner> runner;
798     auto locatorHandler =
799         new (std::nothrow) LocatorHandler(runner);
800     int state = 1;
801     AppExecFwk::InnerEvent::Pointer event  =
802         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
803     locatorHandler->RegLocationErrorEvent(event);
804     locatorHandler->UnRegLocationErrorEvent(event);
805     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandler001 end");
806 }
807 
808 HWTEST_F(LocatorAbilityTest, LocatorHandler002, TestSize.Level1)
809 {
810     GTEST_LOG_(INFO)
811         << "LocatorAbilityTest, LocatorHandler002, TestSize.Level1";
812     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandler002 begin");
813     std::shared_ptr<AppExecFwk::EventRunner> runner;
814     auto locatorHandler =
815         new (std::nothrow) LocatorHandler(runner);
816     int state = 1;
817     AppExecFwk::InnerEvent::Pointer event  =
818         AppExecFwk::InnerEvent::Get(EVENT_SEND_SWITCHSTATE_TO_HIFENCE, state);
819     locatorHandler->SyncIdleState(event);
820     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorHandler002 end");
821 }
822 
823 HWTEST_F(LocatorAbilityTest, LocatorCallbackDeathRecipient001, TestSize.Level1)
824 {
825     GTEST_LOG_(INFO)
826         << "LocatorAbilityTest, LocatorCallbackDeathRecipient001, TestSize.Level1";
827     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorCallbackDeathRecipient001 begin");
828     int32_t tokenId = 1;
829     auto recipient =
830         sptr<LocatorCallbackDeathRecipient>(new (std::nothrow) LocatorCallbackDeathRecipient(tokenId));
831     wptr<IRemoteObject> remote;
832     recipient->OnRemoteDied(remote);
833     LBSLOGI(LOCATOR, "[LocatorAbilityTest] LocatorCallbackDeathRecipient001 end");
834 }
835 }  // namespace Location
836 }  // namespace OHOS