Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest Class Reference

Public Member Functions

void downloadCallsJNIFunctions () throws NameNotFoundException
 
void downloadCallsJNIFunctionsWithFilenameFromManifest () throws NameNotFoundException
 
void downloadCallsJNIFunctionsWithSharedLibraryNameFromManifest () throws NameNotFoundException
 
void manifestMappingHandlesBaseModuleEmptyString () throws NameNotFoundException
 
void searchPathsAddsApks () throws NameNotFoundException
 
void searchPathsSearchesSplitConfig () throws NameNotFoundException
 
void invalidSearchPathsAreIgnored () throws NameNotFoundException
 
void assetManagerUpdateInvoked () throws NameNotFoundException
 
void stateGetterReturnsUnknowByDefault () throws NameNotFoundException
 
void loadingUnitMappingFindsMatch () throws NameNotFoundException
 
void assetOnlyMappingParses () throws NameNotFoundException
 

Detailed Description

Definition at line 35 of file PlayStoreDeferredComponentManagerTest.java.

Member Function Documentation

◆ assetManagerUpdateInvoked()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.assetManagerUpdateInvoked ( ) throws NameNotFoundException
inline

Definition at line 295 of file PlayStoreDeferredComponentManagerTest.java.

295 {
296 TestFlutterJNI jni = new TestFlutterJNI();
297 Context spyContext = createSpyContext(null);
298 doReturn(null).when(spyContext).getAssets();
299 AssetManager assetManager = spyContext.getAssets();
300 String apkTestPath = "blah doesn't matter here";
301 doReturn(new File(apkTestPath)).when(spyContext).getFilesDir();
302 TestPlayStoreDeferredComponentManager playStoreManager =
303 new TestPlayStoreDeferredComponentManager(spyContext, jni);
304 jni.setDeferredComponentManager(playStoreManager);
305
306 assertEquals(jni.loadingUnitId, 0);
307
308 playStoreManager.installDeferredComponent(123, "TestModuleName");
309 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
310 assertEquals(jni.updateAssetManagerCalled, 1);
311 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
312
313 assertEquals(jni.assetManager, assetManager);
314 }

◆ assetOnlyMappingParses()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.assetOnlyMappingParses ( ) throws NameNotFoundException
inline

Definition at line 341 of file PlayStoreDeferredComponentManagerTest.java.

341 {
342 TestFlutterJNI jni = new TestFlutterJNI();
343 Bundle bundle = new Bundle();
344 bundle.putString(PlayStoreDeferredComponentManager.MAPPING_KEY, "");
345 Context spyContext = createSpyContext(bundle);
346 TestPlayStoreDeferredComponentManager playStoreManager =
347 new TestPlayStoreDeferredComponentManager(spyContext, jni);
348 }

◆ downloadCallsJNIFunctions()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.downloadCallsJNIFunctions ( ) throws NameNotFoundException
inline

Definition at line 105 of file PlayStoreDeferredComponentManagerTest.java.

105 {
106 TestFlutterJNI jni = new TestFlutterJNI();
107 Context spyContext = createSpyContext(null);
108 doReturn(null).when(spyContext).getAssets();
109 String soTestFilename = "libapp.so-123.part.so";
110 String soTestPath = "test/path/" + soTestFilename;
111 doReturn(new File(soTestPath)).when(spyContext).getFilesDir();
112 TestPlayStoreDeferredComponentManager playStoreManager =
113 new TestPlayStoreDeferredComponentManager(spyContext, jni);
114 jni.setDeferredComponentManager(playStoreManager);
115 assertEquals(jni.loadingUnitId, 0);
116
117 playStoreManager.installDeferredComponent(123, "TestModuleName");
118 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
119 assertEquals(jni.updateAssetManagerCalled, 1);
120 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
121
122 assertEquals(jni.searchPaths[0], soTestFilename);
123 assertTrue(jni.searchPaths[1].endsWith(soTestPath));
124 assertEquals(jni.searchPaths.length, 2);
125 assertEquals(jni.loadingUnitId, 123);
126 assertEquals(jni.assetBundlePath, "flutter_assets");
127 }

◆ downloadCallsJNIFunctionsWithFilenameFromManifest()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.downloadCallsJNIFunctionsWithFilenameFromManifest ( ) throws NameNotFoundException
inline

Definition at line 130 of file PlayStoreDeferredComponentManagerTest.java.

130 {
131 TestFlutterJNI jni = new TestFlutterJNI();
132
133 Bundle bundle = new Bundle();
134 bundle.putString(ApplicationInfoLoader.PUBLIC_AOT_SHARED_LIBRARY_NAME, "custom_name.so");
135 bundle.putString(ApplicationInfoLoader.PUBLIC_FLUTTER_ASSETS_DIR_KEY, "custom_assets");
136
137 Context spyContext = createSpyContext(bundle);
138 doReturn(null).when(spyContext).getAssets();
139
140 String soTestFilename = "custom_name.so-123.part.so";
141 String soTestPath = "test/path/" + soTestFilename;
142 doReturn(new File(soTestPath)).when(spyContext).getFilesDir();
143 TestPlayStoreDeferredComponentManager playStoreManager =
144 new TestPlayStoreDeferredComponentManager(spyContext, jni);
145 jni.setDeferredComponentManager(playStoreManager);
146 assertEquals(jni.loadingUnitId, 0);
147
148 playStoreManager.installDeferredComponent(123, "TestModuleName");
149 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
150 assertEquals(jni.updateAssetManagerCalled, 1);
151 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
152
153 assertEquals(jni.searchPaths[0], soTestFilename);
154 assertTrue(jni.searchPaths[1].endsWith(soTestPath));
155 assertEquals(jni.searchPaths.length, 2);
156 assertEquals(jni.loadingUnitId, 123);
157 assertEquals(jni.assetBundlePath, "custom_assets");
158 }

◆ downloadCallsJNIFunctionsWithSharedLibraryNameFromManifest()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.downloadCallsJNIFunctionsWithSharedLibraryNameFromManifest ( ) throws NameNotFoundException
inline

Definition at line 161 of file PlayStoreDeferredComponentManagerTest.java.

162 {
163 TestFlutterJNI jni = new TestFlutterJNI();
164
165 Bundle bundle = new Bundle();
166 bundle.putString(PlayStoreDeferredComponentManager.MAPPING_KEY, "123:module:custom_name.so");
167 bundle.putString(ApplicationInfoLoader.PUBLIC_FLUTTER_ASSETS_DIR_KEY, "custom_assets");
168
169 Context spyContext = createSpyContext(bundle);
170 doReturn(null).when(spyContext).getAssets();
171
172 String soTestFilename = "custom_name.so";
173 String soTestPath = "test/path/" + soTestFilename;
174 doReturn(new File(soTestPath)).when(spyContext).getFilesDir();
175 TestPlayStoreDeferredComponentManager playStoreManager =
176 new TestPlayStoreDeferredComponentManager(spyContext, jni);
177 jni.setDeferredComponentManager(playStoreManager);
178 assertEquals(jni.loadingUnitId, 0);
179
180 playStoreManager.installDeferredComponent(123, "TestModuleName");
181 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
182 assertEquals(jni.updateAssetManagerCalled, 1);
183 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
184
185 assertEquals(jni.searchPaths[0], soTestFilename);
186 assertTrue(jni.searchPaths[1].endsWith(soTestPath));
187 assertEquals(jni.searchPaths.length, 2);
188 assertEquals(jni.loadingUnitId, 123);
189 assertEquals(jni.assetBundlePath, "custom_assets");
190 }

◆ invalidSearchPathsAreIgnored()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.invalidSearchPathsAreIgnored ( ) throws NameNotFoundException
inline

Definition at line 272 of file PlayStoreDeferredComponentManagerTest.java.

272 {
273 TestFlutterJNI jni = new TestFlutterJNI();
274 Context spyContext = createSpyContext(null);
275 doReturn(null).when(spyContext).getAssets();
276 String apkTestPath = "test/path/invalidpath.apk";
277 doReturn(new File(apkTestPath)).when(spyContext).getFilesDir();
278 TestPlayStoreDeferredComponentManager playStoreManager =
279 new TestPlayStoreDeferredComponentManager(spyContext, jni);
280 jni.setDeferredComponentManager(playStoreManager);
281
282 assertEquals(jni.loadingUnitId, 0);
283
284 playStoreManager.installDeferredComponent(123, "TestModuleName");
285 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
286 assertEquals(jni.updateAssetManagerCalled, 1);
287 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
288
289 assertEquals(jni.searchPaths[0], "libapp.so-123.part.so");
290 assertEquals(jni.searchPaths.length, 1);
291 assertEquals(jni.loadingUnitId, 123);
292 }

◆ loadingUnitMappingFindsMatch()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.loadingUnitMappingFindsMatch ( ) throws NameNotFoundException
inline

Definition at line 327 of file PlayStoreDeferredComponentManagerTest.java.

327 {
328 TestFlutterJNI jni = new TestFlutterJNI();
329 Bundle bundle = new Bundle();
330 bundle.putString(PlayStoreDeferredComponentManager.MAPPING_KEY, "2:module1,5:module2");
331 Context spyContext = createSpyContext(bundle);
332 TestPlayStoreDeferredComponentManager playStoreManager =
333 new TestPlayStoreDeferredComponentManager(spyContext, jni);
334
335 assertTrue(playStoreManager.uninstallDeferredComponent(5, null));
336 assertTrue(playStoreManager.uninstallDeferredComponent(2, null));
337 assertFalse(playStoreManager.uninstallDeferredComponent(3, null));
338 }

◆ manifestMappingHandlesBaseModuleEmptyString()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.manifestMappingHandlesBaseModuleEmptyString ( ) throws NameNotFoundException
inline

Definition at line 193 of file PlayStoreDeferredComponentManagerTest.java.

193 {
194 TestFlutterJNI jni = new TestFlutterJNI();
195
196 Bundle bundle = new Bundle();
197 bundle.putString(
198 PlayStoreDeferredComponentManager.MAPPING_KEY, "123:module:custom_name.so,3:,4:");
199 bundle.putString(ApplicationInfoLoader.PUBLIC_FLUTTER_ASSETS_DIR_KEY, "custom_assets");
200
201 Context spyContext = createSpyContext(bundle);
202 doReturn(null).when(spyContext).getAssets();
203
204 String soTestFilename = "libapp.so-3.part.so";
205 String soTestPath = "test/path/" + soTestFilename;
206 doReturn(new File(soTestPath)).when(spyContext).getFilesDir();
207 PlayStoreDeferredComponentManager playStoreManager =
208 new PlayStoreDeferredComponentManager(spyContext, jni);
209 jni.setDeferredComponentManager(playStoreManager);
210 assertEquals(jni.loadingUnitId, 0);
211
212 playStoreManager.installDeferredComponent(3, null);
213 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
214 assertEquals(jni.updateAssetManagerCalled, 0); // no assets to load for base
215 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
216
217 assertEquals(jni.searchPaths[0], soTestFilename);
218 assertTrue(jni.searchPaths[1].endsWith(soTestPath));
219 assertEquals(jni.searchPaths.length, 2);
220 assertEquals(jni.loadingUnitId, 3);
221 }

◆ searchPathsAddsApks()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.searchPathsAddsApks ( ) throws NameNotFoundException
inline

Definition at line 224 of file PlayStoreDeferredComponentManagerTest.java.

224 {
225 TestFlutterJNI jni = new TestFlutterJNI();
226 Context spyContext = createSpyContext(null);
227 doReturn(null).when(spyContext).getAssets();
228 String apkTestPath = "test/path/TestModuleName_armeabi_v7a.apk";
229 doReturn(new File(apkTestPath)).when(spyContext).getFilesDir();
230 TestPlayStoreDeferredComponentManager playStoreManager =
231 new TestPlayStoreDeferredComponentManager(spyContext, jni);
232 jni.setDeferredComponentManager(playStoreManager);
233
234 assertEquals(jni.loadingUnitId, 0);
235
236 playStoreManager.installDeferredComponent(123, "TestModuleName");
237 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
238 assertEquals(jni.updateAssetManagerCalled, 1);
239 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
240
241 assertEquals(jni.searchPaths[0], "libapp.so-123.part.so");
242 assertTrue(jni.searchPaths[1].endsWith(apkTestPath + "!lib/armeabi-v7a/libapp.so-123.part.so"));
243 assertEquals(jni.searchPaths.length, 2);
244 assertEquals(jni.loadingUnitId, 123);
245 }

◆ searchPathsSearchesSplitConfig()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.searchPathsSearchesSplitConfig ( ) throws NameNotFoundException
inline

Definition at line 248 of file PlayStoreDeferredComponentManagerTest.java.

248 {
249 TestFlutterJNI jni = new TestFlutterJNI();
250 Context spyContext = createSpyContext(null);
251 doReturn(null).when(spyContext).getAssets();
252 String apkTestPath = "test/path/split_config.armeabi_v7a.apk";
253 doReturn(new File(apkTestPath)).when(spyContext).getFilesDir();
254 TestPlayStoreDeferredComponentManager playStoreManager =
255 new TestPlayStoreDeferredComponentManager(spyContext, jni);
256 jni.setDeferredComponentManager(playStoreManager);
257
258 assertEquals(jni.loadingUnitId, 0);
259
260 playStoreManager.installDeferredComponent(123, "TestModuleName");
261 assertEquals(jni.loadDartDeferredLibraryCalled, 1);
262 assertEquals(jni.updateAssetManagerCalled, 1);
263 assertEquals(jni.deferredComponentInstallFailureCalled, 0);
264
265 assertEquals(jni.searchPaths[0], "libapp.so-123.part.so");
266 assertTrue(jni.searchPaths[1].endsWith(apkTestPath + "!lib/armeabi-v7a/libapp.so-123.part.so"));
267 assertEquals(jni.searchPaths.length, 2);
268 assertEquals(jni.loadingUnitId, 123);
269 }

◆ stateGetterReturnsUnknowByDefault()

void io.flutter.embedding.engine.deferredcomponents.PlayStoreDeferredComponentManagerTest.stateGetterReturnsUnknowByDefault ( ) throws NameNotFoundException
inline

Definition at line 317 of file PlayStoreDeferredComponentManagerTest.java.

317 {
318 TestFlutterJNI jni = new TestFlutterJNI();
319 Context spyContext = createSpyContext(null);
320 doReturn(null).when(spyContext).getAssets();
321 TestPlayStoreDeferredComponentManager playStoreManager =
322 new TestPlayStoreDeferredComponentManager(spyContext, jni);
323 assertEquals(playStoreManager.getDeferredComponentInstallState(-1, "invalidName"), "unknown");
324 }

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