未验证 提交 3459eb24 编写于 作者: C Christopher Fujino 提交者: GitHub

[flutter_releases] Flutter Stable 2.0.3 Engine Cherrypicks (#25055)

* fixes android deeplink query paremeter null crashes (#24146)
* Update Dart SDK to 2.12.2
* update licenses golden
Co-authored-by: Nchunhtai <47866232+chunhtai@users.noreply.github.com>
上级 5d8bf811
......@@ -35,7 +35,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': 'd6e7aacfe6d19c8d478dcf3e315b76720813a417',
'dart_revision': '65376c07234d1df472662d21dff2498ab2d3cdda',
# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
......
Signature: 56dff2126686e1d0cc09e0792dce6a2a
Signature: 890d97116d1c4d016c71fa50db974d98
UNUSED LICENSES:
......@@ -400,7 +400,7 @@ import java.util.Arrays;
Uri data = intent.getData();
if (data != null && !data.getPath().isEmpty()) {
String pathAndQuery = data.getPath();
if (!data.getQuery().isEmpty()) {
if (data.getQuery() != null && !data.getQuery().isEmpty()) {
pathAndQuery += "?" + data.getQuery();
}
return pathAndQuery;
......
......@@ -456,6 +456,32 @@ public class FlutterActivityAndFragmentDelegateTest {
.setInitialRoute("/custom/route?query=test");
}
@Test
public void
itSendsInitialRouteFromIntentOnStartIfNoInitialRouteFromActivityAndShouldHandleDeeplinkingNoQueryParameter() {
Intent intent = FlutterActivity.createDefaultIntent(RuntimeEnvironment.application);
intent.setData(Uri.parse("http://myApp/custom/route"));
ActivityController<FlutterActivity> activityController =
Robolectric.buildActivity(FlutterActivity.class, intent);
FlutterActivity flutterActivity = activityController.get();
when(mockHost.getActivity()).thenReturn(flutterActivity);
when(mockHost.getInitialRoute()).thenReturn(null);
when(mockHost.shouldHandleDeeplinking()).thenReturn(true);
// Create the real object that we're testing.
FlutterActivityAndFragmentDelegate delegate = new FlutterActivityAndFragmentDelegate(mockHost);
// --- Execute the behavior under test ---
// The FlutterEngine is setup in onAttach().
delegate.onAttach(RuntimeEnvironment.application);
// Emulate app start.
delegate.onStart();
// Verify that the navigation channel was given the initial route message.
verify(mockFlutterEngine.getNavigationChannel(), times(1)).setInitialRoute("/custom/route");
}
@Test
public void itSendsdefaultInitialRouteOnStartIfNotDeepLinkingFromIntent() {
// Creates an empty intent without launch uri.
......@@ -501,6 +527,25 @@ public class FlutterActivityAndFragmentDelegateTest {
.pushRoute("/custom/route?query=test");
}
@Test
public void itSendsPushRouteMessageWhenOnNewIntentNoQueryParameter() {
when(mockHost.shouldHandleDeeplinking()).thenReturn(true);
// Create the real object that we're testing.
FlutterActivityAndFragmentDelegate delegate = new FlutterActivityAndFragmentDelegate(mockHost);
// --- Execute the behavior under test ---
// The FlutterEngine is setup in onAttach().
delegate.onAttach(RuntimeEnvironment.application);
Intent mockIntent = mock(Intent.class);
when(mockIntent.getData()).thenReturn(Uri.parse("http://myApp/custom/route"));
// Emulate the host and call the method that we expect to be forwarded.
delegate.onNewIntent(mockIntent);
// Verify that the navigation channel was given the push route message.
verify(mockFlutterEngine.getNavigationChannel(), times(1)).pushRoute("/custom/route");
}
@Test
public void itForwardsOnNewIntentToFlutterEngine() {
// Create the real object that we're testing.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册