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

Public Member Functions

void deferredComponentChannel_installCompletesResults ()
 
void deferredComponentChannel_installCompletesMultipleResults ()
 
void deferredComponentChannel_getInstallState ()
 

Detailed Description

Definition at line 54 of file DeferredComponentChannelTest.java.

Member Function Documentation

◆ deferredComponentChannel_getInstallState()

void io.flutter.embedding.engine.systemchannels.DeferredComponentChannelTest.deferredComponentChannel_getInstallState ( )
inline

Definition at line 103 of file DeferredComponentChannelTest.java.

103 {
104 MethodChannel rawChannel = mock(MethodChannel.class);
105 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
106 DartExecutor dartExecutor = new DartExecutor(mockFlutterJNI, mock(AssetManager.class));
107 TestDeferredComponentManager testDeferredComponentManager = new TestDeferredComponentManager();
108 DeferredComponentChannel fakeDeferredComponentChannel =
109 new DeferredComponentChannel(dartExecutor);
110 fakeDeferredComponentChannel.setDeferredComponentManager(testDeferredComponentManager);
111 testDeferredComponentManager.setDeferredComponentChannel(fakeDeferredComponentChannel);
112
113 Map<String, Object> args = new HashMap<>();
114 args.put("loadingUnitId", -1);
115 args.put("componentName", "hello");
116 MethodCall methodCall = new MethodCall("getDeferredComponentInstallState", args);
117 MethodChannel.Result mockResult = mock(MethodChannel.Result.class);
118 fakeDeferredComponentChannel.parsingMethodHandler.onMethodCall(methodCall, mockResult);
119
120 testDeferredComponentManager.completeInstall();
121 verify(mockResult).success("installed");
122 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static ::testing::Matcher< GBytes * > MethodCall(const std::string &name, ::testing::Matcher< FlValue * > args)

◆ deferredComponentChannel_installCompletesMultipleResults()

void io.flutter.embedding.engine.systemchannels.DeferredComponentChannelTest.deferredComponentChannel_installCompletesMultipleResults ( )
inline

Definition at line 78 of file DeferredComponentChannelTest.java.

78 {
79 MethodChannel rawChannel = mock(MethodChannel.class);
80 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
81 DartExecutor dartExecutor = new DartExecutor(mockFlutterJNI, mock(AssetManager.class));
82 TestDeferredComponentManager testDeferredComponentManager = new TestDeferredComponentManager();
83 DeferredComponentChannel fakeDeferredComponentChannel =
84 new DeferredComponentChannel(dartExecutor);
85 fakeDeferredComponentChannel.setDeferredComponentManager(testDeferredComponentManager);
86 testDeferredComponentManager.setDeferredComponentChannel(fakeDeferredComponentChannel);
87
88 Map<String, Object> args = new HashMap<>();
89 args.put("loadingUnitId", -1);
90 args.put("componentName", "hello");
91 MethodCall methodCall = new MethodCall("installDeferredComponent", args);
92 MethodChannel.Result mockResult1 = mock(MethodChannel.Result.class);
93 MethodChannel.Result mockResult2 = mock(MethodChannel.Result.class);
94 fakeDeferredComponentChannel.parsingMethodHandler.onMethodCall(methodCall, mockResult1);
95 fakeDeferredComponentChannel.parsingMethodHandler.onMethodCall(methodCall, mockResult2);
96
97 testDeferredComponentManager.completeInstall();
98 verify(mockResult1).success(null);
99 verify(mockResult2).success(null);
100 }

◆ deferredComponentChannel_installCompletesResults()

void io.flutter.embedding.engine.systemchannels.DeferredComponentChannelTest.deferredComponentChannel_installCompletesResults ( )
inline

Definition at line 56 of file DeferredComponentChannelTest.java.

56 {
57 MethodChannel rawChannel = mock(MethodChannel.class);
58 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
59 DartExecutor dartExecutor = new DartExecutor(mockFlutterJNI, mock(AssetManager.class));
60 TestDeferredComponentManager testDeferredComponentManager = new TestDeferredComponentManager();
61 DeferredComponentChannel fakeDeferredComponentChannel =
62 new DeferredComponentChannel(dartExecutor);
63 fakeDeferredComponentChannel.setDeferredComponentManager(testDeferredComponentManager);
64 testDeferredComponentManager.setDeferredComponentChannel(fakeDeferredComponentChannel);
65
66 Map<String, Object> args = new HashMap<>();
67 args.put("loadingUnitId", -1);
68 args.put("componentName", "hello");
69 MethodCall methodCall = new MethodCall("installDeferredComponent", args);
70 MethodChannel.Result mockResult = mock(MethodChannel.Result.class);
71 fakeDeferredComponentChannel.parsingMethodHandler.onMethodCall(methodCall, mockResult);
72
73 testDeferredComponentManager.completeInstall();
74 verify(mockResult).success(null);
75 }

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