Skip to content

Commit

Permalink
[google_maps_android_flutter] Convert Config.sdk to minSdk in Rob…
Browse files Browse the repository at this point in the history
…olectric tests and lower to `LOLLIPOP` (#7805)

Tests in the title package that are run using the Robolectric test
runner will now run on all SDKs level >= LOLLIPOP (i.e. 21). Raises max
heap size to 1G.

Affects only tests, should be version-bump exempt.

Fixes flutter/flutter#152931

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] page, which explains my
responsibilities.
- [x] I read and followed the [relevant style guides] and ran the
auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages
repo does use `dart format`.)
- [ ] I signed the [CLA].
- [x] The title of the PR starts with the name of the package surrounded
by square brackets, e.g. `[shared_preferences]`
- [x] I [linked to at least one issue that this PR fixes] in the
description above.
- [x] I updated `pubspec.yaml` with an appropriate new version according
to the [pub versioning philosophy], or this PR is [exempt from version
changes].
- [x] I updated `CHANGELOG.md` to add a description of the change,
[following repository CHANGELOG style], or this PR is [exempt from
CHANGELOG changes].
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md
[relevant style guides]:
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[linked to at least one issue that this PR fixes]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview
[pub versioning philosophy]: https://dart.dev/tools/pub/versioning
[exempt from version changes]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#version
[following repository CHANGELOG style]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog-style
[exempt from CHANGELOG changes]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog
[test-exempt]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests
  • Loading branch information
yaakovschectman authored Oct 18, 2024
1 parent 2a1c477 commit 8be261c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/camera/camera_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ buildFeatures {
unitTests.includeAndroidResources = true
unitTests.returnDefaultValues = true
unitTests.all {
// The org.gradle.jvmargs property that may be set in gradle.properties does not impact
// the Java heap size when running the Android unit tests. The following property here
// sets the heap size to a size large enough to run the robolectric tests across
// multiple SDK levels.
jvmArgs "-Xmx1g"
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ android {
outputs.upToDateWhen {false}
showStandardStreams = true
}
// The org.gradle.jvmargs property that may be set in gradle.properties does not impact
// the Java heap size when running the Android unit tests. The following property here
// sets the heap size to a size large enough to run the robolectric tests across
// multiple SDK levels.
jvmArgs "-Xmx1g"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
public class ClusterManagersControllerTest {
private Context context;
private MapsCallbackApi flutterApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(minSdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
public class ConvertTest {
@Mock private AssetManager assetManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
public class GoogleMapControllerTest {

private Context context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
public class GoogleMapInitializerTest {
private GoogleMapInitializer googleMapInitializer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
public class HeatmapsControllerTest {
private HeatmapsController controller;
private GoogleMap googleMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
public class MarkersControllerTest {
private Context context;
private MapsCallbackApi flutterApi;
Expand Down

0 comments on commit 8be261c

Please sign in to comment.