1 /*
2 * Copyright (c) 2023-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 <gtest/gtest.h>
17
18 #define private public
19 #include "account_observer.h"
20 #include "hisysevent_observer.h"
21 #include "mmi_observer.h"
22 #include "fold_display_mode_observer.h"
23 #include "device_movement_observer.h"
24 #include "sched_telephony_observer.h"
25 #include "audio_observer.h"
26 #include "connection_subscriber.h"
27 #include "if_system_ability_manager.h"
28 #include "system_ability_definition.h"
29 #include "iservice_registry.h"
30 #include "observer_manager.h"
31 #include "download_upload_observer.h"
32
33 namespace OHOS {
34 namespace ResourceSchedule {
35 namespace {
36 static const int32_t TEST_UID = 0;
37 static const int32_t TEST_PID = 1000;
38 static const int32_t TEST_INSTANCE_ID = 123456;
39 static const int32_t JSON_FORMAT = 4;
40 }
41 class ObserverEventTest : public testing::Test {
42 public:
43 static void SetUpTestCase();
44 static void TearDownTestCase();
SetUp()45 void SetUp() {}
TearDown()46 void TearDown() {}
47 static std::shared_ptr<HiSysEventObserver> hisysEventObserver_;
48 static std::shared_ptr<MmiObserver> mmiObserver_;
49 static std::shared_ptr<ConnectionSubscriber> connectionSubscriber_;
50 #ifdef DEVICE_MOVEMENT_PERCEPTION_ENABLE
51 static std::shared_ptr<DeviceMovementObserver> deviceMovementObserver_;
52 #endif
53 #ifdef RESSCHED_TELEPHONY_STATE_REGISTRY_ENABLE
54 static std::shared_ptr<SchedTelephonyObserver> schedTelephonyObserver_;
55 #endif
56 #ifdef RESSCHED_AUDIO_FRAMEWORK_ENABLE
57 static std::shared_ptr<AudioObserver> audioObserver_;
58 #endif
59 static std::shared_ptr<FoldDisplayModeObserver> foldDisplayModeObserver_;
60 };
61
62 std::shared_ptr<HiSysEventObserver> ObserverEventTest::hisysEventObserver_ = nullptr;
63 std::shared_ptr<MmiObserver> ObserverEventTest::mmiObserver_ = nullptr;
64 std::shared_ptr<FoldDisplayModeObserver> ObserverEventTest::foldDisplayModeObserver_ = nullptr;
65 std::shared_ptr<ConnectionSubscriber> ObserverEventTest::connectionSubscriber_ = nullptr;
66 #ifdef DEVICE_MOVEMENT_PERCEPTION_ENABLE
67 std::shared_ptr<DeviceMovementObserver> ObserverEventTest::deviceMovementObserver_ = nullptr;
68 #endif
69 #ifdef RESSCHED_TELEPHONY_STATE_REGISTRY_ENABLE
70 std::shared_ptr<SchedTelephonyObserver> ObserverEventTest::schedTelephonyObserver_ = nullptr;
71 #endif
72 #ifdef RESSCHED_AUDIO_FRAMEWORK_ENABLE
73 std::shared_ptr<AudioObserver> ObserverEventTest::audioObserver_ = nullptr;
74 #endif
75
SetUpTestCase()76 void ObserverEventTest::SetUpTestCase()
77 {
78 hisysEventObserver_ = std::make_shared<HiSysEventObserver>();
79 mmiObserver_ = std::make_shared<MmiObserver>();
80 connectionSubscriber_ = std::make_shared<ConnectionSubscriber>();
81 foldDisplayModeObserver_ = std::make_shared<FoldDisplayModeObserver>();
82 #ifdef DEVICE_MOVEMENT_PERCEPTION_ENABLE
83 deviceMovementObserver_ = std::make_shared<DeviceMovementObserver>();
84 #endif
85 #ifdef RESSCHED_TELEPHONY_STATE_REGISTRY_ENABLE
86 schedTelephonyObserver_ = std::make_shared<SchedTelephonyObserver>();
87 #endif
88 #ifdef RESSCHED_AUDIO_FRAMEWORK_ENABLE
89 audioObserver_ = std::make_shared<AudioObserver>();
90 #endif
91 }
92
TearDownTestCase()93 void ObserverEventTest::TearDownTestCase()
94 {
95 hisysEventObserver_ = nullptr;
96 mmiObserver_ = nullptr;
97 connectionSubscriber_ = nullptr;
98 foldDisplayModeObserver_ = nullptr;
99 #ifdef DEVICE_MOVEMENT_PERCEPTION_ENABLE
100 deviceMovementObserver_ = nullptr;
101 #endif
102 #ifdef RESSCHED_TELEPHONY_STATE_REGISTRY_ENABLE
103 schedTelephonyObserver_ = nullptr;
104 #endif
105 #ifdef RESSCHED_AUDIO_FRAMEWORK_ENABLE
106 audioObserver_ = nullptr;
107 #endif
108 }
109
110 /**
111 * @tc.name: hisysEventAvCodecEvent_001
112 * @tc.desc: test multimedia encoding and decoding event processing
113 * @tc.type: FUNC
114 * @tc.require: issueI8IDAO
115 */
116 HWTEST_F(ObserverEventTest, hisysEventAvCodecEvent_001, testing::ext::TestSize.Level1)
117 {
118 nlohmann::json sysEvent;
119 std::string eventName = "INVAILD";
120 sysEvent["name_"] = eventName;
121
122 // incorrect uid keyword
123 sysEvent["UID"] = TEST_UID;
124 hisysEventObserver_->ProcessAvCodecEvent(sysEvent, eventName);
125 EXPECT_NE(hisysEventObserver_, nullptr);
126
127 // incorrect pid keyword
128 sysEvent["CLIENT_UID"] = TEST_UID;
129 sysEvent["PID"] = TEST_PID;
130 hisysEventObserver_->ProcessAvCodecEvent(sysEvent, eventName);
131 EXPECT_NE(hisysEventObserver_, nullptr);
132
133 // incorrect instance id keyword
134 sysEvent["CLIENT_UID"] = TEST_UID;
135 sysEvent["CLIENT_PID"] = TEST_PID;
136 sysEvent["INSTANCE_ID"] = TEST_INSTANCE_ID;
137 hisysEventObserver_->ProcessAvCodecEvent(sysEvent, eventName);
138 EXPECT_NE(hisysEventObserver_, nullptr);
139
140 // codec start info state scene
141 sysEvent["CODEC_INSTANCE_ID"] = TEST_INSTANCE_ID;
142 eventName = "CODEC_START_INFO";
143 sysEvent["name_"] = eventName;
144 hisysEventObserver_->ProcessAvCodecEvent(sysEvent, eventName);
145 EXPECT_NE(hisysEventObserver_, nullptr);
146
147 // codec stop info state scene
148 eventName = "CODEC_STOP_INFO";
149 sysEvent["name_"] = eventName;
150 hisysEventObserver_->ProcessAvCodecEvent(sysEvent, eventName);
151 EXPECT_NE(hisysEventObserver_, nullptr);
152
153 // codec fault state scene
154 eventName = "FAULT";
155 sysEvent["name_"] = eventName;
156 hisysEventObserver_->ProcessAvCodecEvent(sysEvent, eventName);
157 EXPECT_NE(hisysEventObserver_, nullptr);
158 }
159
160 /**
161 * @tc.name: hisysEventRunningLockEvent_001
162 * @tc.desc: test running lock event processing
163 * @tc.type: FUNC
164 * @tc.require: issueI8IDAO
165 */
166 HWTEST_F(ObserverEventTest, hisysEventRunningLockEvent_001, testing::ext::TestSize.Level1)
167 {
168 nlohmann::json sysEvent;
169 std::string eventName = "INVAILD";
170 // incorrect uid keyword
171 sysEvent["uid"] = TEST_UID;
172 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
173 EXPECT_NE(hisysEventObserver_, nullptr);
174
175 // incorrect pid keyword
176 sysEvent["UID"] = TEST_UID;
177 sysEvent["pid"] = TEST_PID;
178 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
179 EXPECT_NE(hisysEventObserver_, nullptr);
180
181 // incorrect type keyword
182 sysEvent["PID"] = TEST_PID;
183 sysEvent["type"] = 0;
184 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
185 EXPECT_NE(hisysEventObserver_, nullptr);
186
187 // incorrect state keyword
188 sysEvent["TYPE"] = 0;
189 sysEvent["state"] = 0;
190 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
191 EXPECT_NE(hisysEventObserver_, nullptr);
192
193 // running lock state disable
194 sysEvent["STATE"] = RunningLockState::RUNNINGLOCK_STATE_DISABLE;
195 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
196 EXPECT_NE(hisysEventObserver_, nullptr);
197
198 // running lock state enable
199 sysEvent["STATE"] = RunningLockState::RUNNINGLOCK_STATE_ENABLE;
200 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
201 EXPECT_NE(hisysEventObserver_, nullptr);
202
203 // running lock state proxied
204 sysEvent["STATE"] = RunningLockState::RUNNINGLOCK_STATE_PROXIED;
205 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
206 sysEvent["STATE"] = -1;
207 hisysEventObserver_->ProcessRunningLockEvent(sysEvent, eventName);
208 EXPECT_NE(hisysEventObserver_, nullptr);
209 }
210
211 /**
212 * @tc.name: hisysEventAudioEvent_001
213 * @tc.desc: test hisysevent audio event processing
214 * @tc.type: FUNC
215 * @tc.require: issueI8IDAO
216 */
217 HWTEST_F(ObserverEventTest, hisysEventAudioEvent_001, testing::ext::TestSize.Level1)
218 {
219 nlohmann::json sysEvent;
220 std::string eventName = "INVAILD";
221 // incorrect uid keyword
222 sysEvent["uid"] = TEST_UID;
223 hisysEventObserver_->ProcessAudioEvent(sysEvent, eventName);
224 EXPECT_NE(hisysEventObserver_, nullptr);
225
226 // incorrect pid keyword
227 sysEvent["UID"] = TEST_UID;
228 sysEvent["pid"] = TEST_PID;
229 hisysEventObserver_->ProcessAudioEvent(sysEvent, eventName);
230 EXPECT_NE(hisysEventObserver_, nullptr);
231
232 // incorrect state keyword
233 sysEvent["PID"] = TEST_PID;
234 sysEvent["STATE"] = -1;
235 hisysEventObserver_->ProcessAudioEvent(sysEvent, eventName);
236 sysEvent["state"] = 0;
237 hisysEventObserver_->ProcessAudioEvent(sysEvent, eventName);
238 EXPECT_NE(hisysEventObserver_, nullptr);
239
240 // audio state running
241 sysEvent["STATE"] = AudioState::AUDIO_STATE_RUNNING;
242 hisysEventObserver_->ProcessAudioEvent(sysEvent, eventName);
243 EXPECT_NE(hisysEventObserver_, nullptr);
244
245 // audio state stopped
246 sysEvent["STATE"] = AudioState::AUDIO_STATE_STOPPED;
247 hisysEventObserver_->ProcessAudioEvent(sysEvent, eventName);
248 EXPECT_NE(hisysEventObserver_, nullptr);
249 }
250
251 /**
252 * @tc.name: hisysEventCameraEvent_001
253 * @tc.desc: test hisysevent camera event processing
254 * @tc.type: FUNC
255 * @tc.require: issueI8IDAO
256 */
257 HWTEST_F(ObserverEventTest, hisysEventCameraEvent_001, testing::ext::TestSize.Level1)
258 {
259 nlohmann::json sysEvent;
260 std::string eventName = "INVAILD";
261 // incorrect uid keyword
262 sysEvent["uid"] = TEST_UID;
263 hisysEventObserver_->ProcessCameraEvent(sysEvent, eventName);
264 EXPECT_NE(hisysEventObserver_, nullptr);
265
266 // incorrect pid keyword
267 sysEvent["UID"] = TEST_UID;
268 sysEvent["pid"] = TEST_PID;
269 hisysEventObserver_->ProcessCameraEvent(sysEvent, eventName);
270 EXPECT_NE(hisysEventObserver_, nullptr);
271
272 // eventName test
273 sysEvent["PID"] = TEST_PID;
274 eventName = "CAMERA_CONNECT";
275 hisysEventObserver_->ProcessCameraEvent(sysEvent, eventName);
276 EXPECT_NE(hisysEventObserver_, nullptr);
277
278 eventName = "CAMERA_DISCONNECT";
279 hisysEventObserver_->ProcessCameraEvent(sysEvent, eventName);
280 EXPECT_NE(hisysEventObserver_, nullptr);
281 }
282
283 /**
284 * @tc.name: hisysEventBluetoothEvent_001
285 * @tc.desc: test hisysevent bluetooth event processing
286 * @tc.type: FUNC
287 * @tc.require: issueI8IDAO
288 */
289 HWTEST_F(ObserverEventTest, hisysEventBluetoothEvent_001, testing::ext::TestSize.Level1)
290 {
291 nlohmann::json sysEvent;
292 std::string eventName = "INVAILD";
293 // incorrect uid keyword
294 sysEvent["uid"] = TEST_UID;
295 hisysEventObserver_->ProcessBluetoothEvent(sysEvent, eventName);
296 EXPECT_NE(hisysEventObserver_, nullptr);
297
298 // incorrect pid keyword
299 sysEvent["UID"] = TEST_UID;
300 sysEvent["pid"] = TEST_PID;
301 hisysEventObserver_->ProcessBluetoothEvent(sysEvent, eventName);
302 EXPECT_NE(hisysEventObserver_, nullptr);
303
304 // incorrect state keyword
305 sysEvent["PID"] = TEST_PID;
306 sysEvent["state"] = 0;
307 hisysEventObserver_->ProcessBluetoothEvent(sysEvent, eventName);
308 EXPECT_NE(hisysEventObserver_, nullptr);
309
310 // bluetooth state turn on
311 sysEvent["STATE"] = 1;
312 hisysEventObserver_->ProcessBluetoothEvent(sysEvent, eventName);
313 EXPECT_NE(hisysEventObserver_, nullptr);
314
315 // bluetooth state turn off
316 sysEvent["STATE"] = 3;
317 hisysEventObserver_->ProcessBluetoothEvent(sysEvent, eventName);
318 EXPECT_NE(hisysEventObserver_, nullptr);
319 }
320
321 /**
322 * @tc.name: hisysEventWifiEvent_001
323 * @tc.desc: test hisysevent wifi event processing
324 * @tc.type: FUNC
325 * @tc.require: issueI8IDAO
326 */
327 HWTEST_F(ObserverEventTest, hisysEventWifiEvent_001, testing::ext::TestSize.Level1)
328 {
329 nlohmann::json sysEvent;
330 std::string eventName = "INVAILD";
331 // incorrect uid keyword
332 sysEvent["uid"] = TEST_UID;
333 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
334 EXPECT_NE(hisysEventObserver_, nullptr);
335
336 // incorrect pid keyword
337 sysEvent["uid_"] = TEST_UID;
338 sysEvent["pid"] = TEST_PID;
339 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
340 EXPECT_NE(hisysEventObserver_, nullptr);
341
342 // incorrect eventname
343 sysEvent["pid_"] = TEST_PID;
344 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
345 EXPECT_NE(hisysEventObserver_, nullptr);
346
347 // wifi connection state: connected
348 eventName = "WIFI_CONNECTION";
349 sysEvent["TYPE"] = WifiState::CONNECTED;
350 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
351 EXPECT_NE(hisysEventObserver_, nullptr);
352
353 // wifi connection state: disconnected
354 sysEvent["TYPE"] = WifiState::DISCONNECTED;
355 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
356 EXPECT_NE(hisysEventObserver_, nullptr);
357
358 // wifi scan state
359 eventName = "WIFI_SCAN";
360 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
361 sysEvent["TYPE"] = -1;
362 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
363 eventName = "test";
364 hisysEventObserver_->ProcessWifiEvent(sysEvent, eventName);
365 EXPECT_NE(hisysEventObserver_, nullptr);
366 }
367
368 /**
369 * @tc.name: processHiSysEvent_001
370 * @tc.desc: the hisysevent onevent test
371 * @tc.type: FUNC
372 * @tc.require: issueI8IDAO
373 */
374 HWTEST_F(ObserverEventTest, processHiSysEvent_001, testing::ext::TestSize.Level1)
375 {
376 hisysEventObserver_->OnEvent(nullptr);
377 hisysEventObserver_->OnServiceDied();
378 nlohmann::json sysEvent;
379 sysEvent["domain_"] = "RUNNINGLOCK";
380 sysEvent["name_"] = "RUNNINGLOCK";
381 sysEvent["UID"] = TEST_UID;
382 sysEvent["PID"] = TEST_PID;
383 hisysEventObserver_->OnEvent(std::make_shared<HiviewDFX::HiSysEventRecord>(
384 sysEvent.dump(JSON_FORMAT)));
385 EXPECT_NE(hisysEventObserver_, nullptr);
386 }
387
388 /**
389 * @tc.name: processHiSysEvent_002
390 * @tc.desc: the process hisysevent test
391 * @tc.type: FUNC
392 * @tc.require: issueI8IDAO
393 */
394 HWTEST_F(ObserverEventTest, processHiSysEvent_002, testing::ext::TestSize.Level1)
395 {
396 nlohmann::json sysEvent;
397 std::string eventName = "INVAILD";
398 sysEvent["domain_"] = "AV_CODEC";
399 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
400 EXPECT_NE(hisysEventObserver_, nullptr);
401
402 sysEvent["domain_"] = "INVAILD";
403 eventName = "RUNNINGLOCK";
404 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
405 EXPECT_NE(hisysEventObserver_, nullptr);
406 }
407
408 /**
409 * @tc.name: processHiSysEvent_003
410 * @tc.desc: the process hisysevent test
411 * @tc.type: FUNC
412 * @tc.require: issuesIAJZVI
413 */
414 HWTEST_F(ObserverEventTest, processHiSysEvent_003, testing::ext::TestSize.Level1)
415 {
416 nlohmann::json sysEvent;
417 sysEvent["domain_"] = "INVAILD";
418 std::string eventName = "CAMERA_CONNECT";
419 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
420 eventName = "CAMERA_DISCONNECT";
421 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
422 eventName = "BR_SWITCH_STATE";
423 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
424 eventName = "BLE_SWITCH_STATE";
425 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
426 eventName = "WIFI_CONNECTION";
427 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
428 eventName = "WIFI_SCAN";
429 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
430 eventName = "PLAYER_STATE";
431 hisysEventObserver_->ProcessHiSysEvent(eventName, sysEvent);
432 EXPECT_NE(hisysEventObserver_, nullptr);
433 }
434
435 /**
436 * @tc.name: mmiObserverEvent_001
437 * @tc.desc: test multimodal input sync bundleName interface
438 * @tc.type: FUNC
439 * @tc.require: issueI8IDAO
440 */
441 HWTEST_F(ObserverEventTest, mmiObserverEvent_001, testing::ext::TestSize.Level1)
442 {
443 int32_t pid = TEST_PID;
444 int32_t uid = TEST_UID;
445 std::string bundleName;
446 int32_t status = 0;
447 // the scene of bundleName is null
448 mmiObserver_->SyncBundleName(pid, uid, bundleName, status);
449 EXPECT_NE(mmiObserver_, nullptr);
450
451 // the scene of bundleName is not null
452 bundleName = "inputmethod";
453 mmiObserver_->SyncBundleName(pid, uid, bundleName, status);
454 EXPECT_NE(mmiObserver_, nullptr);
455 }
456
457 /**
458 * @tc.name: deviceMovementObserverEvent_001
459 * @tc.desc: test multimodal input sync bundleName interface
460 * @tc.type: FUNC
461 * @tc.require: issueI8VZVN
462 */
463 HWTEST_F(ObserverEventTest, deviceMovementObserverEvent_001, testing::ext::TestSize.Level1)
464 {
465 #ifdef DEVICE_MOVEMENT_PERCEPTION_ENABLE
466 // data is null
467 int32_t code = -1;
468 MessageParcel data;
469 MessageParcel reply;
470 MessageOption option;
471 int32_t testRequest = deviceMovementObserver_->OnRemoteRequest(code, data, reply, option);
472 EXPECT_EQ(testRequest, -1);
473
474 //code is MOVEMENT_CHANGE
475 data.WriteInterfaceToken(DeviceMovementObserver::GetDescriptor());
476 code = static_cast<int32_t>(Msdp::ImovementCallback::MOVEMENT_CHANGE);
477 int32_t t1 = deviceMovementObserver_->OnRemoteRequest(code, data, reply, option);
478 EXPECT_EQ(t1, 0);
479
480 //code is not MOVEMENT_CHANGE
481 code = -1;
482 int32_t t2 = deviceMovementObserver_->OnRemoteRequest(code, data, reply, option);
483 EXPECT_EQ(t2, -1);
484 #endif
485 }
486
487 /**
488 * @tc.name: schedTelephonyObserverEvent_001
489 * @tc.desc: test multimodal input sync bundleName interface
490 * @tc.type: FUNC
491 * @tc.require: issueI8VZVN
492 */
493 HWTEST_F(ObserverEventTest, schedTelephonyObserverEvent_001, testing::ext::TestSize.Level1)
494 {
495 #ifdef RESSCHED_TELEPHONY_STATE_REGISTRY_ENABLE
496 int32_t slotId = 0;
497 int32_t callState = 0;
498 std::u16string phoneNumber;
499 schedTelephonyObserver_->OnCallStateUpdated(slotId, callState, phoneNumber);
500 EXPECT_TRUE(schedTelephonyObserver_ != nullptr);
501 #endif
502 }
503
504 /**
505 * @tc.name: connectionSubscriberEvent_001
506 * @tc.desc: test multimodal input sync bundleName interface
507 * @tc.type: FUNC
508 * @tc.require: issueI8VZVN
509 */
510 HWTEST_F(ObserverEventTest, connectionSubscriberEvent_001, testing::ext::TestSize.Level1)
511 {
512 //test the interface
513 AbilityRuntime::ConnectionData data;
514 AbilityRuntime::DlpStateData data1;
515 nlohmann::json payload;
516 connectionSubscriber_->MarshallingConnectionData(data, payload);
517 SUCCEED();
518 connectionSubscriber_->OnExtensionConnected(data);
519 SUCCEED();
520 connectionSubscriber_->OnExtensionDisconnected(data);
521 SUCCEED();
522 connectionSubscriber_->MarshallingDlpStateData(data1, payload);
523 SUCCEED();
524 connectionSubscriber_->OnDlpAbilityOpened(data1);
525 SUCCEED();
526 connectionSubscriber_->OnDlpAbilityClosed(data1);
527 SUCCEED();
528 connectionSubscriber_->OnServiceDied();
529 EXPECT_TRUE(connectionSubscriber_ != nullptr);
530 }
531
532 /**
533 * @tc.name: audioObserverObserverEvent_001
534 * @tc.desc: test multimodal input sync bundleName interface
535 * @tc.type: FUNC
536 * @tc.require: issueI8VZVN
537 */
538 HWTEST_F(ObserverEventTest, audioObserverEvent_001, testing::ext::TestSize.Level1)
539 {
540 #ifdef RESSCHED_AUDIO_FRAMEWORK_ENABLE
541 std::unique_ptr<AudioStandard::AudioRendererChangeInfo> audioRendererChangeInfo =
542 std::make_unique<AudioStandard::AudioRendererChangeInfo>();
543 nlohmann::json payload;
544 audioObserver_->MarshallingAudioRendererChangeInfo(audioRendererChangeInfo, payload);
545 SUCCEED();
546 std::vector<std::unique_ptr<AudioStandard::AudioRendererChangeInfo>> audioRenderVector;
547 audioRenderVector.emplace_back(std::move(audioRendererChangeInfo));
548 audioObserver_->OnRendererStateChange(audioRenderVector);
549 SUCCEED();
550
551 //ringerMode equals mode_
552 AudioStandard::AudioRingerMode ringerMode = AudioStandard::AudioRingerMode::RINGER_MODE_NORMAL;
553 audioObserver_->OnRingerModeUpdated(ringerMode);
554 SUCCEED();
555 //ringerMode is not mode_
556 audioObserver_->OnRingerModeUpdated(ringerMode);
557 SUCCEED();
558
559 //test the interface of OnVolumeKeyEvent
560 AudioStandard::VolumeEvent volumeEvent;
561 audioObserver_->OnVolumeKeyEvent(volumeEvent);
562 SUCCEED();
563
564 // test the interface of OnPreferredOutputDeviceUpdated
565 std::vector<sptr<AudioStandard::AudioDeviceDescriptor>> descs;
566 audioObserver_->OnPreferredOutputDeviceUpdated(descs);
567 EXPECT_TRUE(audioObserver_ != nullptr);
568 #endif
569 }
570
571 /**
572 * @tc.name: mmiObserverEvent_002
573 * @tc.desc: test multimodal input get mmi status status interface
574 * @tc.type: FUNC
575 * @tc.require: issueI8ZIVH
576 */
577 HWTEST_F(ObserverEventTest, mmiObserverEvent_002, testing::ext::TestSize.Level1)
578 {
579 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
580 EXPECT_NE(samgr, nullptr);
581 auto remoteObj = samgr->GetSystemAbility(MULTIMODAL_INPUT_SERVICE_ID);
582 if (!remoteObj) {
583 return;
584 }
585 auto instance = ObserverManager::GetInstance();
586 if (instance) {
587 instance->GetAllMmiStatusData();
588 }
589 SUCCEED();
590 }
591
592 #ifdef RESSCHED_REQUEST_REQUEST
593 /**
594 * @tc.name: foldDisplayModeObserver_001
595 * @tc.desc: test fold display mode status interface
596 * @tc.type: FUNC
597 * @tc.require: issueI8ZIVH
598 */
599 HWTEST_F(ObserverEventTest, foldDisplayModeObserver_001, testing::ext::TestSize.Level1)
600 {
601 const std::string DISPLAY_MODE_MAIN = "displayMain";
602 foldDisplayModeObserver_->OnDisplayModeChanged(FoldDisplayMode::MAIN);
603 EXPECT_EQ(foldDisplayModeObserver_->currentDisplayMode, DISPLAY_MODE_MAIN);
604
605 const std::string DISPLAY_MODE_FULL = "displayFull";
606 foldDisplayModeObserver_->OnDisplayModeChanged(FoldDisplayMode::FULL);
607 EXPECT_EQ(foldDisplayModeObserver_->currentDisplayMode, DISPLAY_MODE_FULL);
608
609 const std::string DISPLAY_MODE_SUB = "displaySub";
610 foldDisplayModeObserver_->OnDisplayModeChanged(FoldDisplayMode::SUB);
611 EXPECT_EQ(foldDisplayModeObserver_->currentDisplayMode, DISPLAY_MODE_SUB);
612
613 const std::string DISPLAY_MODE_UNKOWN = "displayUnknown";
614 foldDisplayModeObserver_->OnDisplayModeChanged(FoldDisplayMode::UNKNOWN);
615 EXPECT_EQ(foldDisplayModeObserver_->currentDisplayMode, DISPLAY_MODE_UNKOWN);
616 }
617
618 /**
619 * @tc.name: downLoadUploadObserver_001
620 * @tc.desc: Test downLoad Upload Observer
621 * @tc.type: FUNC
622 * @tc.require: issuesI9BU37
623 */
624 HWTEST_F(ObserverEventTest, downLoadUploadObserver_001, testing::ext::TestSize.Level1)
625 {
626 std::shared_ptr<DownLoadUploadObserver> downLoadUploadObserver_ =
627 std::make_shared<DownLoadUploadObserver>();
628 downLoadUploadObserver_->OnRunningTaskCountUpdate(1);
629 EXPECT_TRUE(downLoadUploadObserver_->isReportedScene_);
630 downLoadUploadObserver_->OnRunningTaskCountUpdate(0);
631 EXPECT_FALSE(downLoadUploadObserver_->isReportedScene_);
632 downLoadUploadObserver_->OnRunningTaskCountUpdate(-1);
633 EXPECT_FALSE(downLoadUploadObserver_->isReportedScene_);
634 downLoadUploadObserver_ = nullptr;
635 }
636 #endif
637 /**
638 * @tc.name: accountObserver_001
639 * @tc.desc: test account observer
640 * @tc.type: FUNC
641 * @tc.require: issuesI9SSQY
642 */
643 HWTEST_F(ObserverEventTest, accountObserver_001, testing::ext::TestSize.Level1)
644 {
645 AccountSA::OsAccountSubscribeInfo osAccountSubscribeInfo;
646 osAccountSubscribeInfo.SetOsAccountSubscribeType(AccountSA::OS_ACCOUNT_SUBSCRIBE_TYPE::ACTIVATING);
647 osAccountSubscribeInfo.SetName("ResschdeAccountActivatingSubscriberTest");
648 auto accountObserver = std::make_shared<AccountObserver>(osAccountSubscribeInfo);
649 accountObserver->OnAccountsChanged(200);
650 SUCCEED();
651 accountObserver->OnAccountsChanged(201);
652 SUCCEED();
653 accountObserver->OnAccountsChanged(-1);
654 EXPECT_TRUE(accountObserver != nullptr);
655 accountObserver = nullptr;
656 }
657
658 /**
659 * @tc.name: OnEvent_001
660 * @tc.desc: test account observer
661 * @tc.type: FUNC
662 * @tc.require: issuesI9SSQY
663 */
664 HWTEST_F(ObserverEventTest, OnEvent_001, testing::ext::TestSize.Level1)
665 {
666 nlohmann::json sysEvent;
667 sysEvent["domain_"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST";
668 hisysEventObserver_->OnEvent(std::make_shared<HiviewDFX::HiSysEventRecord>(
669 sysEvent.dump(JSON_FORMAT)));
670 sysEvent["name_"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
671 sysEvent["test1"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
672 sysEvent["test2"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
673 sysEvent["test3"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
674 sysEvent["test4"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
675 sysEvent["test5"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
676 sysEvent["test6"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
677 sysEvent["test7"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
678 sysEvent["test8"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
679 sysEvent["test9"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
680 sysEvent["test10"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
681 sysEvent["test11"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
682 sysEvent["test12"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
683 sysEvent["test13"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
684 sysEvent["test14"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
685 sysEvent["test15"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
686 sysEvent["test16"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
687 sysEvent["test17"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
688 sysEvent["test18"] = "RUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTESTRUNNINGLOCKTEST1";
689 sysEvent["UID"] = TEST_UID;
690 sysEvent["PID"] = TEST_PID;
691 hisysEventObserver_->OnEvent(std::make_shared<HiviewDFX::HiSysEventRecord>(
692 sysEvent.dump(JSON_FORMAT)));
693 sysEvent["domain_"] = 1;
694 hisysEventObserver_->OnEvent(std::make_shared<HiviewDFX::HiSysEventRecord>(
695 sysEvent.dump(JSON_FORMAT)));
696 EXPECT_NE(hisysEventObserver_, nullptr);
697 EXPECT_NE(hisysEventObserver_, nullptr);
698 }
699
700 /**
701 * @tc.name: DisableDataShareObserver_001
702 * @tc.desc: test account observer DisableDataShareObserver
703 * @tc.type: FUNC
704 * @tc.require: issuesI9SSQY
705 */
706 HWTEST_F(ObserverEventTest, DisableDataShareObserver_001, testing::ext::TestSize.Level1)
707 {
708 auto instance = ObserverManager::GetInstance();
709 if (instance) {
710 instance->DisableDataShareObserver();
711 }
712 EXPECT_TRUE(instance);
713 }
714
715 /**
716 * @tc.name: DisableAudioObserver_001
717 * @tc.desc: test account observer DisableAudioObserver
718 * @tc.type: FUNC
719 * @tc.require: issuesI9SSQY
720 */
721 HWTEST_F(ObserverEventTest, DisableAudioObserver_001, testing::ext::TestSize.Level1)
722 {
723 auto instance = ObserverManager::GetInstance();
724 if (instance) {
725 instance->DisableAudioObserver();
726 instance->InitAudioObserver();
727 instance->DisableAudioObserver();
728 }
729 #ifdef RESSCHED_AUDIO_FRAMEWORK_ENABLE
730 EXPECT_EQ(instance->audioObserver_, nullptr);
731 #else
732 SUCCEED();
733 #endif
734 }
735
736 /**
737 * @tc.name: DisableDeviceMovementObserver_001
738 * @tc.desc: test account observer DisableDeviceMovementObserver
739 * @tc.type: FUNC
740 * @tc.require: issuesI9SSQY
741 */
742 HWTEST_F(ObserverEventTest, DisableDeviceMovementObserver_001, testing::ext::TestSize.Level1)
743 {
744 auto instance = ObserverManager::GetInstance();
745 if (instance) {
746 instance->DisableDeviceMovementObserver();
747 instance->InitDeviceMovementObserver();
748 instance->DisableDeviceMovementObserver();
749 }
750 #ifdef DEVICE_MOVEMENT_PERCEPTION_ENABLE
751 EXPECT_EQ(instance->deviceMovementObserver_, nullptr);
752 #else
753 SUCCEED();
754 #endif
755 }
756
757 /**
758 * @tc.name: DisableMMiEventObserver_001
759 * @tc.desc: test account observer DisableMMiEventObserver
760 * @tc.type: FUNC
761 * @tc.require: issuesI9SSQY
762 */
763 HWTEST_F(ObserverEventTest, DisableMMiEventObserver_001, testing::ext::TestSize.Level1)
764 {
765 auto instance = ObserverManager::GetInstance();
766 if (instance) {
767 instance->DisableMMiEventObserver();
768 }
769 EXPECT_EQ(instance->mmiEventObserver_, nullptr);
770 }
771
772 /**
773 * @tc.name: DisableMMiEventObserver_002
774 * @tc.desc: test account observer DisableMMiEventObserver
775 * @tc.type: FUNC
776 * @tc.require: issuesI9SSQY
777 */
778 HWTEST_F(ObserverEventTest, DisableMMiEventObserver_002, testing::ext::TestSize.Level1)
779 {
780 auto instance = ObserverManager::GetInstance();
781 if (instance) {
782 instance->isNeedReport_ = true;
783 instance->InitMMiEventObserver();
784 instance->DisableMMiEventObserver();
785 }
786 EXPECT_EQ(instance->mmiEventObserver_, nullptr);
787 }
788
789 /**
790 * @tc.name: DisableConnectionSubscriber_001
791 * @tc.desc: test account observer DisableConnectionSubscriber
792 * @tc.type: FUNC
793 * @tc.require: issuesI9SSQY
794 */
795 HWTEST_F(ObserverEventTest, DisableConnectionSubscriber_001, testing::ext::TestSize.Level1)
796 {
797 auto instance = ObserverManager::GetInstance();
798 if (instance) {
799 instance->DisableConnectionSubscriber();
800 instance->InitConnectionSubscriber();
801 instance->DisableConnectionSubscriber();
802 }
803 EXPECT_EQ(instance->connectionSubscriber_, nullptr);
804 }
805
806 /**
807 * @tc.name: DisableAVSessionStateChangeListener_001
808 * @tc.desc: test account observer DisableAVSessionStateChangeListener
809 * @tc.type: FUNC
810 * @tc.require: issuesI9SSQY
811 */
812 #ifdef RESSCHED_MULTIMEDIA_AV_SESSION_ENABLE
813 HWTEST_F(ObserverEventTest, DisableAVSessionStateChangeListener_001, testing::ext::TestSize.Level1)
814 {
815 auto instance = ObserverManager::GetInstance();
816 if (instance) {
817 instance->DisableAVSessionStateChangeListener();
818 }
819 EXPECT_EQ(instance->avSessionStateListener_, nullptr);
820 }
821 #endif
822
823 #ifndef RESOURCE_REQUEST_REQUEST
824 /**
825 * @tc.name: DisableDownloadUploadObserver_001
826 * @tc.desc: test account observer DisableDownloadUploadObserver
827 * @tc.type: FUNC
828 * @tc.require: issuesI9SSQY
829 */
830 HWTEST_F(ObserverEventTest, DisableDownloadUploadObserver_001, testing::ext::TestSize.Level1)
831 {
832 auto instance = ObserverManager::GetInstance();
833 if (instance) {
834 instance->DisableDownloadUploadObserver();
835 }
836 EXPECT_EQ(instance->downLoadUploadObserver_, nullptr);
837 }
838
839 /**
840 * @tc.name: InitDownloadUploadObserver_001
841 * @tc.desc: test account observer InitDownloadUploadObserver
842 * @tc.type: FUNC
843 * @tc.require: issuesI9SSQY
844 */
845 HWTEST_F(ObserverEventTest, InitDownloadUploadObserver_001, testing::ext::TestSize.Level1)
846 {
847 auto instance = ObserverManager::GetInstance();
848 if (instance) {
849 instance->InitDownloadUploadObserver();
850 }
851 EXPECT_NE(instance->downLoadUploadObserver_, nullptr);
852 }
853 #endif
854
855 /**
856 * @tc.name: DisableTelephonyObserver_001
857 * @tc.desc: test account observer DisableTelephonyObserver
858 * @tc.type: FUNC
859 * @tc.require: issuesI9SSQY
860 */
861 HWTEST_F(ObserverEventTest, DisableTelephonyObserver_001, testing::ext::TestSize.Level1)
862 {
863 auto instance = ObserverManager::GetInstance();
864 if (instance) {
865 instance->DisableTelephonyObserver();
866 }
867 #ifdef RESSCHED_TELEPHONY_STATE_REGISTRY_ENABLE
868 EXPECT_EQ(instance->telephonyObserver_, nullptr);
869 #else
870 SUCCEED();
871 #endif
872 }
873
874 /**
875 * @tc.name: DisableHiSysEventObserver_001
876 * @tc.desc: test account observer DisableHiSysEventObserver
877 * @tc.type: FUNC
878 * @tc.require: issuesI9SSQY
879 */
880 HWTEST_F(ObserverEventTest, DisableHiSysEventObserver_001, testing::ext::TestSize.Level1)
881 {
882 auto instance = ObserverManager::GetInstance();
883 if (instance) {
884 instance->DisableHiSysEventObserver();
885 }
886 EXPECT_EQ(instance->hiSysEventObserver_, nullptr);
887 }
888
889 /**
890 * @tc.name: DisableDisplayModeObserver_001
891 * @tc.desc: test account observer DisableDisplayModeObserver
892 * @tc.type: FUNC
893 * @tc.require: issuesI9SSQY
894 */
895 HWTEST_F(ObserverEventTest, DisableDisplayModeObserver_001, testing::ext::TestSize.Level1)
896 {
897 auto instance = ObserverManager::GetInstance();
898 if (instance) {
899 instance->foldDisplayModeObserver_ = nullptr;
900 instance->DisableDisplayModeObserver();
901 }
902 EXPECT_EQ(instance->foldDisplayModeObserver_, nullptr);
903 }
904
905 /**
906 * @tc.name: InitDisplayModeObserver_001
907 * @tc.desc: test account observer InitDisplayModeObserver
908 * @tc.type: FUNC
909 * @tc.require: issuesI9SSQY
910 */
911 HWTEST_F(ObserverEventTest, InitDisplayModeObserver_001, testing::ext::TestSize.Level1)
912 {
913 auto instance = ObserverManager::GetInstance();
914 if (instance) {
915 instance->foldDisplayModeObserver_ = nullptr;
916 instance->InitDisplayModeObserver();
917 instance->InitDisplayModeObserver();
918 instance->DisableDisplayModeObserver();
919 }
920 EXPECT_EQ(instance->foldDisplayModeObserver_, nullptr);
921 }
922
923 /**
924 * @tc.name: GetAllMmiStatusData_001
925 * @tc.desc: test account observer GetAllMmiStatusData
926 * @tc.type: FUNC
927 * @tc.require: issuesI9SSQY
928 */
929 HWTEST_F(ObserverEventTest, GetAllMmiStatusData_001, testing::ext::TestSize.Level1)
930 {
931 auto instance = ObserverManager::GetInstance();
932 EXPECT_NE(instance, nullptr);
933 if (instance) {
934 instance->GetAllMmiStatusData();
935 }
936 SUCCEED();
937 }
938
939 /**
940 * @tc.name: AddItemToSysAbilityListener_001
941 * @tc.desc: test AddItemToSysAbilityListener
942 * @tc.type: FUNC
943 * @tc.require: issuesIAJZVI
944 */
945 HWTEST_F(ObserverEventTest, AddItemToSysAbilityListener_001, testing::ext::TestSize.Level1)
946 {
947 sptr<ISystemAbilityManager> systemAbilityManager
948 = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
949 auto instance = ObserverManager::GetInstance();
950 if (instance) {
951 instance->AddItemToSysAbilityListener(DFX_SYS_EVENT_SERVICE_ABILITY_ID, systemAbilityManager);
952 instance->AddItemToSysAbilityListener(-1, systemAbilityManager);
953 }
954 EXPECT_FALSE(instance->sysAbilityListener_);
955 }
956
957 /**
958 * @tc.name: OnRemoveSystemAbility_001
959 * @tc.desc: test OnRemoveSystemAbility
960 * @tc.type: FUNC
961 * @tc.require: issuesIAJZVI
962 */
963 HWTEST_F(ObserverEventTest, OnRemoveSystemAbility_001, testing::ext::TestSize.Level1)
964 {
965 std::string deviceId = "test";
966 auto instance = ObserverManager::GetInstance();
967 EXPECT_NE(instance, nullptr);
968 if (instance) {
969 instance->InitSysAbilityListener();
970 instance->sysAbilityListener_->OnAddSystemAbility(DFX_SYS_EVENT_SERVICE_ABILITY_ID, deviceId);
971 instance->sysAbilityListener_->OnRemoveSystemAbility(DFX_SYS_EVENT_SERVICE_ABILITY_ID, deviceId);
972
973 instance->sysAbilityListener_->OnAddSystemAbility(TELEPHONY_STATE_REGISTRY_SYS_ABILITY_ID, deviceId);
974 instance->sysAbilityListener_->OnRemoveSystemAbility(TELEPHONY_STATE_REGISTRY_SYS_ABILITY_ID, deviceId);
975
976 instance->sysAbilityListener_->OnAddSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID, deviceId);
977 instance->sysAbilityListener_->OnRemoveSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID, deviceId);
978
979 #ifdef RESSCHED_MULTIMEDIA_AV_SESSION_ENABLE
980 instance->sysAbilityListener_->OnAddSystemAbility(AVSESSION_SERVICE_ID, deviceId);
981 instance->sysAbilityListener_->OnRemoveSystemAbility(AVSESSION_SERVICE_ID, deviceId);
982 #endif
983
984 instance->sysAbilityListener_->OnAddSystemAbility(SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN, deviceId);
985 instance->sysAbilityListener_->OnRemoveSystemAbility(SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN, deviceId);
986
987 instance->sysAbilityListener_->OnRemoveSystemAbility(-1, deviceId);
988 }
989 SUCCEED();
990 }
991
992 /**
993 * @tc.name: InitAccountObserver_001
994 * @tc.desc: test InitAccountObserver
995 * @tc.type: FUNC
996 * @tc.require: issuesIAJZVI
997 */
998 HWTEST_F(ObserverEventTest, InitAccountObserver_001, testing::ext::TestSize.Level1)
999 {
1000 auto observerManager = std::make_shared<ObserverManager>();
1001 observerManager->InitAccountObserver();
1002 observerManager->DisableAccountObserver();
1003 observerManager->DisableAccountObserver();
1004 EXPECT_NE(observerManager->accountObserver_, nullptr);
1005 }
1006
1007 }
1008 }