Flutter Engine
The Flutter Engine
Public Member Functions | Package Attributes | List of all members
io.flutter.FlutterInjectorTest Class Reference

Public Member Functions

void setUp ()
 
void tearDown ()
 
void itHasSomeReasonableDefaults ()
 
void executorCreatesAndNamesNewThreadsByDefault () throws InterruptedException, ExecutionException
 
void canPartiallyOverride ()
 
void canInjectDeferredComponentManager ()
 
void canInjectExecutorService ()
 
void cannotBeChangedOnceRead ()
 

Package Attributes

FlutterLoader mockFlutterLoader
 
PlayStoreDeferredComponentManager mockDeferredComponentManager
 
ExecutorService mockExecutorService
 

Detailed Description

Definition at line 32 of file FlutterInjectorTest.java.

Member Function Documentation

◆ canInjectDeferredComponentManager()

void io.flutter.FlutterInjectorTest.canInjectDeferredComponentManager ( )
inline

Definition at line 91 of file FlutterInjectorTest.java.

91 {
92 FlutterInjector.setInstance(
93 new FlutterInjector.Builder()
94 .setDeferredComponentManager(mockDeferredComponentManager)
95 .build());
96 FlutterInjector injector = FlutterInjector.instance();
97 assertEquals(injector.deferredComponentManager(), mockDeferredComponentManager);
98 }
PlayStoreDeferredComponentManager mockDeferredComponentManager

◆ canInjectExecutorService()

void io.flutter.FlutterInjectorTest.canInjectExecutorService ( )
inline

Definition at line 101 of file FlutterInjectorTest.java.

101 {
102 FlutterInjector.setInstance(
103 new FlutterInjector.Builder().setExecutorService(mockExecutorService).build());
104 FlutterInjector injector = FlutterInjector.instance();
105 assertEquals(injector.executorService(), mockExecutorService);
106 }

◆ cannotBeChangedOnceRead()

void io.flutter.FlutterInjectorTest.cannotBeChangedOnceRead ( )
inline

Definition at line 109 of file FlutterInjectorTest.java.

109 {
110 FlutterInjector.instance();
111
112 assertThrows(
113 IllegalStateException.class,
114 () -> {
115 FlutterInjector.setInstance(
116 new FlutterInjector.Builder().setFlutterLoader(mockFlutterLoader).build());
117 });
118 }

◆ canPartiallyOverride()

void io.flutter.FlutterInjectorTest.canPartiallyOverride ( )
inline

Definition at line 83 of file FlutterInjectorTest.java.

83 {
84 FlutterInjector.setInstance(
85 new FlutterInjector.Builder().setFlutterLoader(mockFlutterLoader).build());
86 FlutterInjector injector = FlutterInjector.instance();
87 assertEquals(injector.flutterLoader(), mockFlutterLoader);
88 }

◆ executorCreatesAndNamesNewThreadsByDefault()

void io.flutter.FlutterInjectorTest.executorCreatesAndNamesNewThreadsByDefault ( ) throws InterruptedException, ExecutionException
inline

Definition at line 59 of file FlutterInjectorTest.java.

60 {
61 // Implicitly builds when first accessed.
62 FlutterInjector injector = FlutterInjector.instance();
63
64 List<Callable<String>> callables =
65 Arrays.asList(
66 () -> {
67 return Thread.currentThread().getName();
68 },
69 () -> {
70 return Thread.currentThread().getName();
71 });
72
73 List<Future<String>> threadNames;
74 threadNames = injector.executorService().invokeAll(callables);
75
76 assertEquals(threadNames.size(), 2);
77 for (Future<String> name : threadNames) {
78 assertTrue(name.get().startsWith("flutter-worker-"));
79 }
80 }
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ itHasSomeReasonableDefaults()

void io.flutter.FlutterInjectorTest.itHasSomeReasonableDefaults ( )
inline

Definition at line 50 of file FlutterInjectorTest.java.

50 {
51 // Implicitly builds when first accessed.
52 FlutterInjector injector = FlutterInjector.instance();
53 assertNotNull(injector.flutterLoader());
54 assertNull(injector.deferredComponentManager());
55 assertNotNull(injector.executorService());
56 }

◆ setUp()

void io.flutter.FlutterInjectorTest.setUp ( )
inline

Definition at line 38 of file FlutterInjectorTest.java.

38 {
39 // Since the intent is to have a convenient static class to use for production.
40 FlutterInjector.reset();
41 MockitoAnnotations.openMocks(this);
42 }

◆ tearDown()

void io.flutter.FlutterInjectorTest.tearDown ( )
inline

Definition at line 45 of file FlutterInjectorTest.java.

45 {
46 FlutterInjector.reset();
47 }

Member Data Documentation

◆ mockDeferredComponentManager

PlayStoreDeferredComponentManager io.flutter.FlutterInjectorTest.mockDeferredComponentManager
package

Definition at line 34 of file FlutterInjectorTest.java.

◆ mockExecutorService

ExecutorService io.flutter.FlutterInjectorTest.mockExecutorService
package

Definition at line 35 of file FlutterInjectorTest.java.

◆ mockFlutterLoader

FlutterLoader io.flutter.FlutterInjectorTest.mockFlutterLoader
package

Definition at line 33 of file FlutterInjectorTest.java.


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