Flutter Engine
The Flutter Engine
Public Member Functions | Package Attributes | List of all members
io.flutter.embedding.engine.dart.DartExecutorTest Class Reference

Public Member Functions

void setUp ()
 
void itSendsBinaryMessages ()
 
void itNotifiesLowMemoryWarning ()
 
void itThrowsWhenCreatingADefaultDartEntrypointWithAnUninitializedFlutterLoader ()
 
void itHasReasonableDefaultsWhenFlutterLoaderIsInitialized ()
 

Package Attributes

FlutterLoader mockFlutterLoader
 

Detailed Description

Definition at line 29 of file DartExecutorTest.java.

Member Function Documentation

◆ itHasReasonableDefaultsWhenFlutterLoaderIsInitialized()

void io.flutter.embedding.engine.dart.DartExecutorTest.itHasReasonableDefaultsWhenFlutterLoaderIsInitialized ( )
inline

Definition at line 78 of file DartExecutorTest.java.

78 {
79 when(mockFlutterLoader.initialized()).thenReturn(true);
80 when(mockFlutterLoader.findAppBundlePath()).thenReturn("my/custom/path");
81 FlutterInjector.setInstance(
82 new FlutterInjector.Builder().setFlutterLoader(mockFlutterLoader).build());
83 DartEntrypoint entrypoint = DartEntrypoint.createDefault();
84 assertEquals(entrypoint.pathToBundle, "my/custom/path");
85 assertEquals(entrypoint.dartEntrypointFunctionName, "main");
86 }

◆ itNotifiesLowMemoryWarning()

void io.flutter.embedding.engine.dart.DartExecutorTest.itNotifiesLowMemoryWarning ( )
inline

Definition at line 59 of file DartExecutorTest.java.

59 {
60 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
61 when(mockFlutterJNI.isAttached()).thenReturn(true);
62
63 DartExecutor dartExecutor = new DartExecutor(mockFlutterJNI, mock(AssetManager.class));
64 dartExecutor.notifyLowMemoryWarning();
65 verify(mockFlutterJNI, times(1)).notifyLowMemoryWarning();
66 }
static SkISize times(const SkISize &size, float factor)

◆ itSendsBinaryMessages()

void io.flutter.embedding.engine.dart.DartExecutorTest.itSendsBinaryMessages ( )
inline

Definition at line 39 of file DartExecutorTest.java.

39 {
40 // Setup test.
41 FlutterJNI fakeFlutterJni = mock(FlutterJNI.class);
42
43 // Create object under test.
44 DartExecutor dartExecutor = new DartExecutor(fakeFlutterJni, mock(AssetManager.class));
45
46 // Verify a BinaryMessenger exists.
47 assertNotNull(dartExecutor.getBinaryMessenger());
48
49 // Execute the behavior under test.
50 ByteBuffer fakeMessage = mock(ByteBuffer.class);
51 dartExecutor.getBinaryMessenger().send("fake_channel", fakeMessage);
52
53 // Verify that DartExecutor sent our message to FlutterJNI.
54 verify(fakeFlutterJni, times(1))
55 .dispatchPlatformMessage(eq("fake_channel"), eq(fakeMessage), anyInt(), anyInt());
56 }
static bool eq(const SkM44 &a, const SkM44 &b, float tol)
Definition: M44Test.cpp:18

◆ itThrowsWhenCreatingADefaultDartEntrypointWithAnUninitializedFlutterLoader()

void io.flutter.embedding.engine.dart.DartExecutorTest.itThrowsWhenCreatingADefaultDartEntrypointWithAnUninitializedFlutterLoader ( )
inline

Definition at line 69 of file DartExecutorTest.java.

69 {
70 assertThrows(
71 AssertionError.class,
72 () -> {
73 DartEntrypoint.createDefault();
74 });
75 }

◆ setUp()

void io.flutter.embedding.engine.dart.DartExecutorTest.setUp ( )
inline

Definition at line 33 of file DartExecutorTest.java.

33 {
34 FlutterInjector.reset();
35 MockitoAnnotations.openMocks(this);
36 }

Member Data Documentation

◆ mockFlutterLoader

FlutterLoader io.flutter.embedding.engine.dart.DartExecutorTest.mockFlutterLoader
package

Definition at line 30 of file DartExecutorTest.java.


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