88 {
89 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
90 FlutterLoader flutterLoader = new FlutterLoader(mockFlutterJNI);
91
92 assertFalse(flutterLoader.initialized());
93 flutterLoader.startInitialization(ctx);
94 flutterLoader.ensureInitializationComplete(ctx, null);
95 shadowOf(getMainLooper()).idle();
96
97 DisplayMetrics displayMetrics = ctx.getResources().getDisplayMetrics();
98 int screenWidth = displayMetrics.widthPixels;
99 int screenHeight = displayMetrics.heightPixels;
100 int resourceCacheMaxBytesThreshold = screenWidth * screenHeight * 12 * 4;
101 final String resourceCacheMaxBytesThresholdArg =
102 "--resource-cache-max-bytes-threshold=" + resourceCacheMaxBytesThreshold;
103 ArgumentCaptor<String[]> shellArgsCaptor = ArgumentCaptor.forClass(String[].class);
104 verify(mockFlutterJNI,
times(1))
105 .init(
eq(ctx), shellArgsCaptor.capture(), anyString(), anyString(), anyString(), anyLong());
106 List<String> arguments = Arrays.asList(shellArgsCaptor.getValue());
107 assertTrue(arguments.contains(resourceCacheMaxBytesThresholdArg));
108 }