• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 "event_handler_test_common.h"
17 
18 #include <gtest/gtest.h>
19 
20 using namespace testing::ext;
21 using namespace OHOS::AppExecFwk;
22 
23 namespace {
24 /**
25  * Function: Send an event with default priority, and then check the processed result.
26  * @param delayTime Delay time for processing.
27  * @param priority Priority of event.
28  */
SendAndCheck(int64_t delayTime,EventQueue::Priority priority)29 void SendAndCheck(int64_t delayTime, EventQueue::Priority priority)
30 {
31     auto event = InnerEvent::Get(RUN_EVENT_ID);
32     auto myRunner = EventRunner::Create(false);
33     auto handler = std::make_shared<MyEventHandler>(myRunner);
34     bool lValueResult = handler->SendEvent(event, delayTime, priority);
35     EXPECT_TRUE(lValueResult);
36 
37     bool rValueResult = handler->SendEvent(InnerEvent::Get(RUN_EVENT_ID), delayTime, priority);
38     EXPECT_TRUE(rValueResult);
39 
40     handler->SendEvent(STOP_EVENT_ID, 0, delayTime + 1);
41     myRunner->Run();
42     uint32_t runResult = 2;
43     EXPECT_EQ(runResult, CommonUtils::EventRunCount());
44 }
45 
46 /**
47  * Function: Send an event with HIGH or IMMEDIATE priority, and chen check the processed result.
48  * @param priority Priority of event.
49  */
SendEventWithPriority(EventQueue::Priority priority)50 void SendEventWithPriority(EventQueue::Priority priority)
51 {
52     auto event = InnerEvent::Get(RUN_EVENT_ID);
53     auto myRunner = EventRunner::Create(false);
54     auto handler = std::make_shared<MyEventHandler>(myRunner);
55 
56     bool lvalueSendResult = false;
57     bool rvalueSendResult = false;
58     int64_t delayTime = 0;
59 
60     if (priority == EventQueue::Priority::HIGH) {
61         lvalueSendResult = handler->SendHighPriorityEvent(event, delayTime);
62         rvalueSendResult =
63             handler->SendHighPriorityEvent(InnerEvent::Get(RUN_EVENT_ID, std::make_unique<int>(1)), delayTime);
64     }
65 
66     if (priority == EventQueue::Priority::IMMEDIATE) {
67         lvalueSendResult = handler->SendImmediateEvent(event);
68         rvalueSendResult = handler->SendImmediateEvent(InnerEvent::Get(RUN_EVENT_ID, std::make_unique<int>(1)));
69     }
70 
71     EXPECT_TRUE(lvalueSendResult);
72     EXPECT_TRUE(rvalueSendResult);
73     handler->SendEvent(STOP_EVENT_ID);
74     myRunner->Run();
75     uint32_t runResult = 2;
76     EXPECT_EQ(runResult, CommonUtils::EventRunCount());
77 }
78 
79 /**
80  * Function: Send an event by event id with different priority, and check the processed result.
81  * @param priority Priority of event.
82  */
SendEventWithPriorityByEventId(EventQueue::Priority priority)83 void SendEventWithPriorityByEventId(EventQueue::Priority priority)
84 {
85     /**
86      * @tc.steps: step1. Set event by event id with different priority (LOW, HIGH, IMMEDIATE).
87      */
88     auto myRunner = EventRunner::Create(false);
89     auto handler = std::make_shared<MyEventHandler>(myRunner);
90     bool sendResult = false;
91     int64_t param = 0;
92     int64_t delayTime = 0;
93 
94     if (priority == EventQueue::Priority::LOW) {
95         sendResult = handler->SendEvent(RUN_EVENT_ID, param, delayTime);
96     }
97     if (priority == EventQueue::Priority::HIGH) {
98         sendResult = handler->SendHighPriorityEvent(RUN_EVENT_ID, param, delayTime);
99     }
100     if (priority == EventQueue::Priority::IMMEDIATE) {
101         sendResult = handler->SendImmediateEvent(RUN_EVENT_ID, param);
102     }
103 
104     /**
105      * @tc.steps: step2. Check the send and handled result.
106      * @tc.expected: step2. Send successfully and the event handled.
107      */
108     EXPECT_TRUE(sendResult);
109     handler->SendEvent(STOP_EVENT_ID);
110     myRunner->Run();
111     EXPECT_TRUE(CommonUtils::EventRunGet());
112 }
113 
114 /**
115  * Function: Send an event with shared pointer or weak pointer, and check the send result.
116  * @param handler Event handler.
117  * @param priority Priority of event.
118  * @param ptr Shared pointer or weak pointer.
119  */
120 template<typename T>
SendEventWithSharedOrWeakPtr(const std::shared_ptr<MyEventHandler> & handler,EventQueue::Priority priority,const T & ptr)121 void SendEventWithSharedOrWeakPtr(
122     const std::shared_ptr<MyEventHandler> &handler, EventQueue::Priority priority, const T &ptr)
123 {
124     bool retVal = false;
125     if (priority == EventQueue::Priority::LOW) {
126         retVal = handler->SendEvent(RUN_EVENT_ID, ptr, 0);
127     }
128     if (priority == EventQueue::Priority::HIGH) {
129         retVal = handler->SendHighPriorityEvent(RUN_EVENT_ID, ptr, 0);
130     }
131     if (priority == EventQueue::Priority::IMMEDIATE) {
132         retVal = handler->SendImmediateEvent(RUN_EVENT_ID, ptr);
133     }
134     EXPECT_TRUE(retVal);
135 }
136 
137 /**
138  * Function: Send an event with unique pointer, and check the send result.
139  * @param handler Event handler.
140  * @param priority Priority of event.
141  * @param isRValue Is or not right value.
142  */
SendEventWithUniquePtr(const std::shared_ptr<MyEventHandler> & handler,EventQueue::Priority priority,bool isRValue=false)143 void SendEventWithUniquePtr(
144     const std::shared_ptr<MyEventHandler> &handler, EventQueue::Priority priority, bool isRValue = false)
145 {
146     auto f = [](int *intPtr) { delete intPtr; };
147     auto uniquePtr = std::unique_ptr<int, void (*)(int *)>((new int(1)), f);
148     bool retVal = false;
149     switch (priority) {
150         case EventQueue::Priority::LOW: {
151             if (!isRValue) {
152                 retVal = handler->SendEvent(RUN_EVENT_ID, uniquePtr, 0);
153             } else {
154                 retVal = handler->SendEvent(RUN_EVENT_ID, std::unique_ptr<int, void (*)(int *)>((new int(1)), f), 0);
155             }
156             break;
157         }
158         case EventQueue::Priority::HIGH: {
159             if (!isRValue) {
160                 retVal = handler->SendHighPriorityEvent(RUN_EVENT_ID, uniquePtr, 0);
161             } else {
162                 retVal = handler->SendHighPriorityEvent(
163                     RUN_EVENT_ID, std::unique_ptr<int, void (*)(int *)>((new int(1)), f), 0);
164             }
165             break;
166         }
167         case EventQueue::Priority::IMMEDIATE: {
168             if (!isRValue) {
169                 retVal = handler->SendImmediateEvent(RUN_EVENT_ID, uniquePtr);
170             } else {
171                 retVal =
172                     handler->SendImmediateEvent(RUN_EVENT_ID, std::unique_ptr<int, void (*)(int *)>((new int(1)), f));
173             }
174             break;
175         }
176         default:
177             break;
178     }
179 
180     EXPECT_TRUE(retVal);
181 }
182 
183 /**
184  * Function: Send event with smart pointer, and then check the processed result.
185  * @param smartPointerType One of smart pointer.
186  * @param priority Priority of event.
187  */
SendEventWithSmartPtr(SmartPointerType smartPointerType,EventQueue::Priority priority)188 void SendEventWithSmartPtr(SmartPointerType smartPointerType, EventQueue::Priority priority)
189 {
190     /**
191      * @tc.steps: step1. Send event with different priority and smart pointer.
192      * @tc.expected: step1. Send successfully and the event handled.
193      */
194     auto myRunner = EventRunner::Create(false);
195     auto handler = std::make_shared<MyEventHandler>(myRunner);
196     auto sharedPtr = std::make_shared<int>(1);
197     auto weakPtr = std::weak_ptr<int>(sharedPtr);
198 
199     switch (smartPointerType) {
200         case SmartPointerType::SHARED_PTR: {
201             SendEventWithSharedOrWeakPtr(handler, priority, sharedPtr);
202             break;
203         }
204         case SmartPointerType::WEAK_PTR: {
205             SendEventWithSharedOrWeakPtr(handler, priority, weakPtr);
206             break;
207         }
208         case SmartPointerType::LVALUE_REFERENCE_UNIQUE_PTR: {
209             SendEventWithUniquePtr(handler, priority);
210             break;
211         }
212         case SmartPointerType::RVALUE_REFERENCE_UNIQUE_PTR: {
213             SendEventWithUniquePtr(handler, priority, true);
214             break;
215         }
216         default:
217             break;
218     }
219 
220     handler->SendEvent(STOP_EVENT_ID, 0, 1);
221     myRunner->Run();
222     EXPECT_TRUE(CommonUtils::EventRunGet());
223 }
224 }  // unnamed namespace
225 
226 class EventHandlerSendEventModuleTest : public testing::Test {
227 public:
228     static void SetUpTestCase(void);
229     static void TearDownTestCase(void);
230     void SetUp();
231     void TearDown();
232 };
233 
SetUpTestCase(void)234 void EventHandlerSendEventModuleTest::SetUpTestCase(void)
235 {}
236 
TearDownTestCase(void)237 void EventHandlerSendEventModuleTest::TearDownTestCase(void)
238 {}
239 
SetUp(void)240 void EventHandlerSendEventModuleTest::SetUp(void)
241 {
242     /**
243      * @tc.setup: Set the value of test flags to the default.
244      */
245     CommonUtils::EventRunSet(false);
246     CommonUtils::EventRunCountReset();
247 }
248 
TearDown(void)249 void EventHandlerSendEventModuleTest::TearDown(void)
250 {}
251 
252 /**
253  * @tc.name: Send001
254  * @tc.desc: Send event with delayTime = 0 and priority = LOW
255  * @tc.type: FUNC
256  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
257  */
258 HWTEST_F(EventHandlerSendEventModuleTest, Send001, TestSize.Level1)
259 {
260     /**
261      * @tc.steps: step1. Send event with delayTime and priority.
262      * @tc.expected: step1. Send successfully and the event handled.
263      */
264     int64_t delayTime = 0;
265     SendAndCheck(delayTime, EventQueue::Priority::LOW);
266 }
267 
268 /**
269  * @tc.name: Send002
270  * @tc.desc: Send event with delayTime > 0 and priority = LOW
271  * @tc.type: FUNC
272  * @tc.require: SR000CQ2AL SR000BTOPJ SR000BTOPM
273  */
274 HWTEST_F(EventHandlerSendEventModuleTest, Send002, TestSize.Level1)
275 {
276     /**
277      * @tc.steps: step1. Send event with delayTime and priority.
278      * @tc.expected: step1. Send successfully and the event handled.
279      */
280     int64_t delayTime = 1;
281     SendAndCheck(delayTime, EventQueue::Priority::LOW);
282 }
283 
284 /**
285  * @tc.name: Send003
286  * @tc.desc: Send event with delayTime < 0 and priority = LOW
287  * @tc.type: FUNC
288  * @tc.require: AR000CQ2AD SR000BTOPJ SR000BTOPM
289  */
290 HWTEST_F(EventHandlerSendEventModuleTest, Send003, TestSize.Level1)
291 {
292     /**
293      * @tc.steps: step1. Send event with delayTime and priority.
294      * @tc.expected: step1. Send successfully and the event handled.
295      */
296     int64_t delayTime = -1;
297     SendAndCheck(delayTime, EventQueue::Priority::LOW);
298 }
299 
300 /**
301  * @tc.name: Send004
302  * @tc.desc: Send event with priority = HIGH
303  * @tc.type: FUNC
304  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
305  */
306 HWTEST_F(EventHandlerSendEventModuleTest, Send004, TestSize.Level1)
307 {
308     /**
309      * @tc.steps: step1. Send event with HIGH priority.
310      * @tc.expected: step1. Send successfully and the event handled.
311      */
312     int64_t delayTime = 1;
313     SendAndCheck(delayTime, EventQueue::Priority::HIGH);
314 }
315 
316 /**
317  * @tc.name: Send005
318  * @tc.desc: Send event with priority = IDLE
319  * @tc.type: FUNC
320  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
321  */
322 HWTEST_F(EventHandlerSendEventModuleTest, Send005, TestSize.Level1)
323 {
324     /**
325      * @tc.steps: step1. Send event with IDLE priority.
326      * @tc.expected: step1. Send successfully and the event handled.
327      */
328     int64_t delayTime = 0;
329     auto event = InnerEvent::Get(RUN_EVENT_ID);
330     auto myRunner = EventRunner::Create(false);
331     auto handler = std::make_shared<MyEventHandler>(myRunner);
332     bool sendResult = handler->SendEvent(event, delayTime, EventQueue::Priority::IDLE);
333     EXPECT_TRUE(sendResult);
334 
__anon2a9d596c0302() 335     auto f = [&myRunner]() { myRunner->Stop(); };
336     handler->PostIdleTask(f, delayTime);
337     uint32_t newEventId = 1;
338     int64_t param = 0;
339     handler->SendEvent(newEventId, param, delayTime + 1);
340     myRunner->Run();
341     bool runResult = CommonUtils::EventRunGet();
342     EXPECT_TRUE(runResult);
343 }
344 
345 /**
346  * @tc.name: Send006
347  * @tc.desc: Send event with delayTime and IMMEDIATE priority
348  * @tc.type: FUNC
349  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
350  */
351 HWTEST_F(EventHandlerSendEventModuleTest, Send006, TestSize.Level1)
352 {
353     /**
354      * @tc.steps: step1. Send event with delayTime and IMMEDIATE priority.
355      * @tc.expected: step1. Send successfully and the event handled.
356      */
357     int64_t delayTime = 10;
358     SendAndCheck(delayTime, EventQueue::Priority::IMMEDIATE);
359 }
360 
361 /**
362  * @tc.name: Send007
363  * @tc.desc: Send event with nullptr
364  * @tc.type: FUNC
365  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
366  */
367 HWTEST_F(EventHandlerSendEventModuleTest, Send007, TestSize.Level1)
368 {
369     /**
370      * @tc.steps: step1. Send event with nullptr.
371      * @tc.expected: step1. Send failed.
372      */
373     auto myRunner = EventRunner::Create(false);
374     auto handler = std::make_shared<MyEventHandler>(myRunner);
375     auto nullPtr = InnerEvent::Pointer(nullptr, nullptr);
376     bool result = handler->SendEvent(nullPtr);
377     handler->SendEvent(STOP_EVENT_ID);
378     myRunner->Run();
379     EXPECT_FALSE(result);
380 }
381 
382 /**
383  * @tc.name: Send008
384  * @tc.desc: Send event without event runner
385  * @tc.type: FUNC
386  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
387  */
388 HWTEST_F(EventHandlerSendEventModuleTest, Send008, TestSize.Level1)
389 {
390     /**
391      * @tc.steps: step1. Send event without event runner.
392      * @tc.expected: step1. Send failed.
393      */
394     uint32_t eventId = Random();
395     int64_t param = 0;
396     int64_t delayTime = 0;
397     auto event = InnerEvent::Get(eventId, param);
398     auto handler = std::make_shared<MyEventHandler>(nullptr);
399     bool result = handler->SendEvent(event, delayTime, EventQueue::Priority::LOW);
400     EXPECT_FALSE(result);
401 }
402 
403 /**
404  * @tc.name: Send009
405  * @tc.desc: Send event with eventId, param and delayTime
406  * @tc.type: FUNC
407  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
408  */
409 HWTEST_F(EventHandlerSendEventModuleTest, Send009, TestSize.Level1)
410 {
411     SendEventWithPriorityByEventId(EventQueue::Priority::LOW);
412 }
413 
414 /**
415  * @tc.name: Send010
416  * @tc.desc: Send event with eventId, shared_ptr and delayTime
417  * @tc.type: FUNC
418  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
419  */
420 HWTEST_F(EventHandlerSendEventModuleTest, Send010, TestSize.Level1)
421 {
422     SendEventWithSmartPtr(SmartPointerType::SHARED_PTR, EventQueue::Priority::LOW);
423 }
424 
425 /**
426  * @tc.name: Send011
427  * @tc.desc: Send event with eventId, weak_ptr and delayTime
428  * @tc.type: FUNC
429  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
430  */
431 HWTEST_F(EventHandlerSendEventModuleTest, Send011, TestSize.Level1)
432 {
433     SendEventWithSmartPtr(SmartPointerType::WEAK_PTR, EventQueue::Priority::LOW);
434 }
435 
436 /**
437  * @tc.name: Send012
438  * @tc.desc: Send event with eventId, unique_ptr and delayTime
439  * @tc.type: FUNC
440  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
441  */
442 HWTEST_F(EventHandlerSendEventModuleTest, Send012, TestSize.Level1)
443 {
444     SendEventWithSmartPtr(SmartPointerType::LVALUE_REFERENCE_UNIQUE_PTR, EventQueue::Priority::LOW);
445 }
446 
447 /**
448  * @tc.name: Send013
449  * @tc.desc: Send event with eventId, rvalue reference unique_ptr and delayTime
450  * @tc.type: FUNC
451  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
452  */
453 HWTEST_F(EventHandlerSendEventModuleTest, Send013, TestSize.Level1)
454 {
455     SendEventWithSmartPtr(SmartPointerType::RVALUE_REFERENCE_UNIQUE_PTR, EventQueue::Priority::LOW);
456 }
457 
458 /**
459  * @tc.name: Send014
460  * @tc.desc: Send event with priority = VIP
461  * @tc.type: FUNC
462  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
463  */
464 HWTEST_F(EventHandlerSendEventModuleTest, Send014, TestSize.Level1)
465 {
466     /**
467      * @tc.steps: step1. Send event with VIP priority.
468      * @tc.expected: step1. Send successfully and the event handled.
469      */
470     int64_t delayTime = 0;
471     auto event = InnerEvent::Get(RUN_EVENT_ID);
472     auto myRunner = EventRunner::Create(false);
473     auto handler = std::make_shared<MyEventHandler>(myRunner);
474     bool sendResult = handler->SendEvent(event, delayTime, EventQueue::Priority::VIP);
475     EXPECT_TRUE(sendResult);
476 
__anon2a9d596c0402() 477     auto f = [&myRunner]() { myRunner->Stop(); };
478     handler->PostTask(f, delayTime, EventQueue::Priority::VIP);
479     uint32_t newEventId = 1;
480     int64_t param = 0;
481     handler->SendEvent(newEventId, param, delayTime + 1);
482     myRunner->Run();
483     bool runResult = CommonUtils::EventRunGet();
484     EXPECT_TRUE(runResult);
485 }
486 
487 /**
488  * @tc.name: SendHigh001
489  * @tc.desc: Send high priority event
490  * @tc.type: FUNC
491  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
492  */
493 HWTEST_F(EventHandlerSendEventModuleTest, SendHigh001, TestSize.Level1)
494 {
495     SendEventWithPriority(EventQueue::Priority::HIGH);
496 }
497 
498 /**
499  * @tc.name: SendHigh002
500  * @tc.desc: Send high priority event with eventId, param and delayTime
501  * @tc.type: FUNC
502  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
503  */
504 HWTEST_F(EventHandlerSendEventModuleTest, SendHigh002, TestSize.Level1)
505 {
506     SendEventWithPriorityByEventId(EventQueue::Priority::HIGH);
507 }
508 
509 /**
510  * @tc.name: SendHigh003
511  * @tc.desc: Send high priority event with eventId, shared_ptr and delayTime
512  * @tc.type: FUNC
513  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
514  */
515 HWTEST_F(EventHandlerSendEventModuleTest, SendHigh003, TestSize.Level1)
516 {
517     SendEventWithSmartPtr(SmartPointerType::SHARED_PTR, EventQueue::Priority::HIGH);
518 }
519 
520 /**
521  * @tc.name: SendHigh004
522  * @tc.desc: Send high priority event with eventId, weak_ptr and delayTime
523  * @tc.type: FUNC
524  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
525  */
526 HWTEST_F(EventHandlerSendEventModuleTest, SendHigh004, TestSize.Level1)
527 {
528     SendEventWithSmartPtr(SmartPointerType::WEAK_PTR, EventQueue::Priority::HIGH);
529 }
530 
531 /**
532  * @tc.name: SendHigh005
533  * @tc.desc: Send high priority event with eventId, unique_ptr and delayTime
534  * @tc.type: FUNC
535  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
536  */
537 HWTEST_F(EventHandlerSendEventModuleTest, SendHigh005, TestSize.Level1)
538 {
539     SendEventWithSmartPtr(SmartPointerType::LVALUE_REFERENCE_UNIQUE_PTR, EventQueue::Priority::HIGH);
540 }
541 
542 /**
543  * @tc.name: SendHigh006
544  * @tc.desc: Send high priority event with eventId, rvalue reference unique_ptr and delayTime
545  * @tc.type: FUNC
546  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
547  */
548 HWTEST_F(EventHandlerSendEventModuleTest, SendHigh006, TestSize.Level1)
549 {
550     SendEventWithSmartPtr(SmartPointerType::RVALUE_REFERENCE_UNIQUE_PTR, EventQueue::Priority::HIGH);
551 }
552 
553 /**
554  * @tc.name: SendImmediate001
555  * @tc.desc: Send immediate priority event
556  * @tc.type: FUNC
557  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
558  */
559 HWTEST_F(EventHandlerSendEventModuleTest, SendImmediate001, TestSize.Level1)
560 {
561     SendEventWithPriority(EventQueue::Priority::IMMEDIATE);
562 }
563 
564 /**
565  * @tc.name: SendImmediate002
566  * @tc.desc: Send immediate priority event with eventId and param
567  * @tc.type: FUNC
568  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
569  */
570 HWTEST_F(EventHandlerSendEventModuleTest, SendImmediate002, TestSize.Level1)
571 {
572     SendEventWithPriorityByEventId(EventQueue::Priority::IMMEDIATE);
573 }
574 
575 /**
576  * @tc.name: SendImmediate003
577  * @tc.desc: Send immediate priority event with eventId, shared_ptr and delayTime
578  * @tc.type: FUNC
579  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
580  */
581 HWTEST_F(EventHandlerSendEventModuleTest, SendImmediate003, TestSize.Level1)
582 {
583     SendEventWithSmartPtr(SmartPointerType::SHARED_PTR, EventQueue::Priority::IMMEDIATE);
584 }
585 
586 /**
587  * @tc.name: SendImmediate004
588  * @tc.desc: Send immediate priority event with eventId, weak_ptr and delayTime
589  * @tc.type: FUNC
590  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
591  */
592 HWTEST_F(EventHandlerSendEventModuleTest, SendImmediate004, TestSize.Level1)
593 {
594     SendEventWithSmartPtr(SmartPointerType::WEAK_PTR, EventQueue::Priority::IMMEDIATE);
595 }
596 
597 /**
598  * @tc.name: SendImmediate005
599  * @tc.desc: Send immediate priority event with eventId, unique_ptr and delayTime
600  * @tc.type: FUNC
601  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
602  */
603 HWTEST_F(EventHandlerSendEventModuleTest, SendImmediate005, TestSize.Level1)
604 {
605     SendEventWithSmartPtr(SmartPointerType::LVALUE_REFERENCE_UNIQUE_PTR, EventQueue::Priority::IMMEDIATE);
606 }
607 
608 /**
609  * @tc.name: SendImmediate006
610  * @tc.desc: Send immediate priority event with eventId, rvalue reference unique_ptr and delayTime
611  * @tc.type: FUNC
612  * @tc.require: SR000BTOPD SR000BTOPJ SR000BTOPM
613  */
614 HWTEST_F(EventHandlerSendEventModuleTest, SendImmediate006, TestSize.Level1)
615 {
616     SendEventWithSmartPtr(SmartPointerType::RVALUE_REFERENCE_UNIQUE_PTR, EventQueue::Priority::IMMEDIATE);
617 }
618