Flutter Engine
The Flutter Engine
Public Member Functions | Package Attributes | List of all members
io.flutter.embedding.engine.systemchannels.LifecycleChannelTest Class Reference

Public Member Functions

void setUp ()
 
void lifecycleChannel_handlesResumed ()
 
void lifecycleChannel_handlesInactive ()
 
void lifecycleChannel_handlesPaused ()
 
void lifecycleChannel_handlesDetached ()
 

Package Attributes

LifecycleChannel lifecycleChannel
 
BasicMessageChannel< String > mockChannel
 

Detailed Description

Definition at line 19 of file LifecycleChannelTest.java.

Member Function Documentation

◆ lifecycleChannel_handlesDetached()

void io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.lifecycleChannel_handlesDetached ( )
inline

Definition at line 109 of file LifecycleChannelTest.java.

109 {
110 // Stays inactive, so no event is sent.
112 ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
113 verify(mockChannel, times(1)).send(stringArgumentCaptor.capture());
114 assertEquals("AppLifecycleState.detached", stringArgumentCaptor.getValue());
115
116 // Stays paused, so no event is sent.
118 verify(mockChannel, times(1)).send(any(String.class));
119
121 verify(mockChannel, times(1)).send(any(String.class));
122
124 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
125 verify(mockChannel, times(2)).send(stringArgumentCaptor.capture());
126 assertEquals("AppLifecycleState.inactive", stringArgumentCaptor.getValue());
127
129 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
130 verify(mockChannel, times(3)).send(stringArgumentCaptor.capture());
131 assertEquals("AppLifecycleState.resumed", stringArgumentCaptor.getValue());
132 }
static SkISize times(const SkISize &size, float factor)
SIT bool any(const Vec< 1, T > &x)
Definition: SkVx.h:530

◆ lifecycleChannel_handlesInactive()

void io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.lifecycleChannel_handlesInactive ( )
inline

Definition at line 61 of file LifecycleChannelTest.java.

61 {
63 ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
64 verify(mockChannel, times(1)).send(stringArgumentCaptor.capture());
65 assertEquals("AppLifecycleState.inactive", stringArgumentCaptor.getValue());
66
67 // Stays inactive, so no event is sent.
69 verify(mockChannel, times(1)).send(any(String.class));
70
71 // Stays inactive, so no event is sent.
73 verify(mockChannel, times(1)).send(any(String.class));
74
77 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
78 verify(mockChannel, times(2)).send(stringArgumentCaptor.capture());
79 assertEquals("AppLifecycleState.resumed", stringArgumentCaptor.getValue());
80 }

◆ lifecycleChannel_handlesPaused()

void io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.lifecycleChannel_handlesPaused ( )
inline

Definition at line 83 of file LifecycleChannelTest.java.

83 {
84 // Stays inactive, so no event is sent.
86 ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
87 verify(mockChannel, times(1)).send(stringArgumentCaptor.capture());
88 assertEquals("AppLifecycleState.paused", stringArgumentCaptor.getValue());
89
90 // Stays paused, so no event is sent.
92 verify(mockChannel, times(1)).send(any(String.class));
93
95 verify(mockChannel, times(1)).send(any(String.class));
96
98 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
99 verify(mockChannel, times(2)).send(stringArgumentCaptor.capture());
100 assertEquals("AppLifecycleState.inactive", stringArgumentCaptor.getValue());
101
103 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
104 verify(mockChannel, times(3)).send(stringArgumentCaptor.capture());
105 assertEquals("AppLifecycleState.resumed", stringArgumentCaptor.getValue());
106 }

◆ lifecycleChannel_handlesResumed()

void io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.lifecycleChannel_handlesResumed ( )
inline

Definition at line 30 of file LifecycleChannelTest.java.

30 {
32 ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
33 verify(mockChannel, times(1)).send(stringArgumentCaptor.capture());
34 assertEquals("AppLifecycleState.resumed", stringArgumentCaptor.getValue());
35
37 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
38 verify(mockChannel, times(2)).send(stringArgumentCaptor.capture());
39 assertEquals("AppLifecycleState.inactive", stringArgumentCaptor.getValue());
40
42 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
43 verify(mockChannel, times(3)).send(stringArgumentCaptor.capture());
44 assertEquals("AppLifecycleState.resumed", stringArgumentCaptor.getValue());
45
46 // Stays inactive, so no event is sent.
48 verify(mockChannel, times(4)).send(any(String.class));
49
50 // Stays inactive, so no event is sent.
52 verify(mockChannel, times(5)).send(any(String.class));
53
55 stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
56 verify(mockChannel, times(5)).send(stringArgumentCaptor.capture());
57 assertEquals("AppLifecycleState.resumed", stringArgumentCaptor.getValue());
58 }

◆ setUp()

void io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.setUp ( )
inline

Definition at line 24 of file LifecycleChannelTest.java.

24 {
25 mockChannel = mock(BasicMessageChannel.class);
26 lifecycleChannel = new LifecycleChannel(mockChannel);
27 }

Member Data Documentation

◆ lifecycleChannel

LifecycleChannel io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.lifecycleChannel
package

Definition at line 20 of file LifecycleChannelTest.java.

◆ mockChannel

BasicMessageChannel<String> io.flutter.embedding.engine.systemchannels.LifecycleChannelTest.mockChannel
package

Definition at line 21 of file LifecycleChannelTest.java.


The documentation for this class was generated from the following file: