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 }