@@ -115,6 +115,7 @@ void main() {
115115 // Mock cookies returned by the cookie store
116116 final mockCookie1 = MockHTTPCookie ();
117117 final mockCookie2 = MockHTTPCookie ();
118+ final mockCookie3 = MockHTTPCookie ();
118119
119120 when (mockCookie1.getProperties ()).thenAnswer (
120121 (_) async => < HttpCookiePropertyKey , Object > {
@@ -134,9 +135,18 @@ void main() {
134135 },
135136 );
136137
138+ when (mockCookie3.getProperties ()).thenAnswer (
139+ (_) async => < HttpCookiePropertyKey , Object > {
140+ HttpCookiePropertyKey .name: 'cookie3' ,
141+ HttpCookiePropertyKey .value: 'value3' ,
142+ HttpCookiePropertyKey .domain: '.flutter.dev' ,
143+ HttpCookiePropertyKey .path: '/path' ,
144+ },
145+ );
146+
137147 when (
138148 mockCookieStore.getAllCookies (),
139- ).thenAnswer ((_) async => [mockCookie1, mockCookie2]);
149+ ).thenAnswer ((_) async => [mockCookie1, mockCookie2, mockCookie3 ]);
140150
141151 PigeonOverrides .wKWebsiteDataStore_defaultDataStore =
142152 mockWKWebsiteDataStore;
@@ -149,7 +159,7 @@ void main() {
149159 Uri .parse ('https://flutter.dev' ),
150160 );
151161
152- expect (cookies.length, 2 );
162+ expect (cookies.length, 3 );
153163
154164 expect (cookies[0 ].name, 'cookie1' );
155165 expect (cookies[0 ].value, 'value1' );
@@ -160,6 +170,17 @@ void main() {
160170 expect (cookies[1 ].value, 'value2' );
161171 expect (cookies[1 ].domain, 'flutter.dev' );
162172 expect (cookies[1 ].path, '/path' );
173+
174+ final List <WebViewCookie > cookiesWww = await manager.getCookies (
175+ Uri .parse ('https://www.flutter.dev' ),
176+ );
177+
178+ expect (cookiesWww.length, 3 );
179+
180+ expect (cookiesWww[2 ].name, 'cookie3' );
181+ expect (cookiesWww[2 ].value, 'value3' );
182+ expect (cookiesWww[2 ].domain, '.flutter.dev' );
183+ expect (cookiesWww[2 ].path, '/path' );
163184 });
164185 });
165186}
0 commit comments