Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.embedding.engine.loader.ApplicationInfoLoaderTest Class Reference

Public Member Functions

void itGeneratesCorrectApplicationInfoWithDefaultManifest ()
 
void itGeneratesCorrectApplicationInfoWithCustomValues () throws Exception
 
void itGeneratesCorrectNetworkPolicy () throws Exception
 
void itHandlesBogusInformationInNetworkPolicy () throws Exception
 
void itHandlesNestedSubDomains () throws Exception
 

Detailed Description

Definition at line 36 of file ApplicationInfoLoaderTest.java.

Member Function Documentation

◆ itGeneratesCorrectApplicationInfoWithCustomValues()

void io.flutter.embedding.engine.loader.ApplicationInfoLoaderTest.itGeneratesCorrectApplicationInfoWithCustomValues ( ) throws Exception
inline

Definition at line 73 of file ApplicationInfoLoaderTest.java.

73 {
74 Bundle bundle = new Bundle();
75 bundle.putString(ApplicationInfoLoader.PUBLIC_AOT_SHARED_LIBRARY_NAME, "testaot");
76 bundle.putString(ApplicationInfoLoader.PUBLIC_VM_SNAPSHOT_DATA_KEY, "testvmsnapshot");
77 bundle.putString(ApplicationInfoLoader.PUBLIC_ISOLATE_SNAPSHOT_DATA_KEY, "testisolatesnapshot");
78 bundle.putString(ApplicationInfoLoader.PUBLIC_FLUTTER_ASSETS_DIR_KEY, "testassets");
79 Context context = generateMockContext(bundle, null);
80 FlutterApplicationInfo info = ApplicationInfoLoader.load(context);
81 assertNotNull(info);
82 assertEquals("testaot", info.aotSharedLibraryName);
83 assertEquals("testvmsnapshot", info.vmSnapshotData);
84 assertEquals("testisolatesnapshot", info.isolateSnapshotData);
85 assertEquals("testassets", info.flutterAssetsDir);
86 assertNull(info.nativeLibraryDir);
87 assertEquals("", info.domainNetworkPolicy);
88 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213

◆ itGeneratesCorrectApplicationInfoWithDefaultManifest()

void io.flutter.embedding.engine.loader.ApplicationInfoLoaderTest.itGeneratesCorrectApplicationInfoWithDefaultManifest ( )
inline

Definition at line 39 of file ApplicationInfoLoaderTest.java.

39 {
40 FlutterApplicationInfo info =
41 ApplicationInfoLoader.load(ApplicationProvider.getApplicationContext());
42 assertNotNull(info);
43 assertEquals("libapp.so", info.aotSharedLibraryName);
44 assertEquals("vm_snapshot_data", info.vmSnapshotData);
45 assertEquals("isolate_snapshot_data", info.isolateSnapshotData);
46 assertEquals("flutter_assets", info.flutterAssetsDir);
47 assertEquals("", info.domainNetworkPolicy);
48 assertNull(info.nativeLibraryDir);
49 }

◆ itGeneratesCorrectNetworkPolicy()

void io.flutter.embedding.engine.loader.ApplicationInfoLoaderTest.itGeneratesCorrectNetworkPolicy ( ) throws Exception
inline

Definition at line 91 of file ApplicationInfoLoaderTest.java.

91 {
92 Bundle bundle = new Bundle();
93 String networkPolicyXml =
94 "<network-security-config>"
95 + "<domain-config cleartextTrafficPermitted=\"false\">"
96 + "<domain includeSubdomains=\"true\">secure.example.com</domain>"
97 + "</domain-config>"
98 + "</network-security-config>";
99 Context context = generateMockContext(bundle, networkPolicyXml);
100 FlutterApplicationInfo info = ApplicationInfoLoader.load(context);
101 assertNotNull(info);
102 assertEquals("[[\"secure.example.com\",true,false]]", info.domainNetworkPolicy);
103 }

◆ itHandlesBogusInformationInNetworkPolicy()

void io.flutter.embedding.engine.loader.ApplicationInfoLoaderTest.itHandlesBogusInformationInNetworkPolicy ( ) throws Exception
inline

Definition at line 106 of file ApplicationInfoLoaderTest.java.

106 {
107 Bundle bundle = new Bundle();
108 String networkPolicyXml =
109 "<network-security-config>"
110 + "<domain-config cleartextTrafficPermitted=\"false\">"
111 + "<domain includeSubdomains=\"true\">secure.example.com</domain>"
112 + "<pin-set expiration=\"2018-01-01\">"
113 + "<pin digest=\"SHA-256\">7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=</pin>"
114 + "<!-- backup pin -->"
115 + "<pin digest=\"SHA-256\">fwza0LRMXouZHRC8Ei+4PyuldPDcf3UKgO/04cDM1oE=</pin>"
116 + "</pin-set>"
117 + "</domain-config>"
118 + "</network-security-config>";
119 Context context = generateMockContext(bundle, networkPolicyXml);
120 FlutterApplicationInfo info = ApplicationInfoLoader.load(context);
121 assertNotNull(info);
122 assertEquals("[[\"secure.example.com\",true,false]]", info.domainNetworkPolicy);
123 }

◆ itHandlesNestedSubDomains()

void io.flutter.embedding.engine.loader.ApplicationInfoLoaderTest.itHandlesNestedSubDomains ( ) throws Exception
inline

Definition at line 126 of file ApplicationInfoLoaderTest.java.

126 {
127 Bundle bundle = new Bundle();
128 String networkPolicyXml =
129 "<network-security-config>"
130 + "<domain-config cleartextTrafficPermitted=\"true\">"
131 + "<domain includeSubdomains=\"true\">example.com</domain>"
132 + "<domain-config>"
133 + "<domain includeSubdomains=\"true\">insecure.example.com</domain>"
134 + "</domain-config>"
135 + "<domain-config cleartextTrafficPermitted=\"false\">"
136 + "<domain includeSubdomains=\"true\">secure.example.com</domain>"
137 + "</domain-config>"
138 + "</domain-config>"
139 + "</network-security-config>";
140 Context context = generateMockContext(bundle, networkPolicyXml);
141 FlutterApplicationInfo info = ApplicationInfoLoader.load(context);
142 assertNotNull(info);
143 assertEquals(
144 "[[\"example.com\",true,true],[\"insecure.example.com\",true,true],[\"secure.example.com\",true,false]]",
145 info.domainNetworkPolicy);
146 }

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