diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-06-13 03:02:51 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-06-13 03:02:51 +0000 |
commit | c44fa6e47683aeb6c900f1b442a15bbfaaf8cc1d (patch) | |
tree | fd4fab0ba10af8f69b953a5ffdf9f2c15734ca23 | |
parent | a65273f3bdf0527b101e51b6c5fba0ff51585831 (diff) | |
parent | 466c50ab5c4943c0c9a139d42a1b4d9af7d65a02 (diff) | |
download | setupwizard-pie-dr1-release.tar.gz |
Snap for 4836998 from 466c50ab5c4943c0c9a139d42a1b4d9af7d65a02 to pi-dr1-releaseandroid-9.0.0_r12android-9.0.0_r11pie-dr1-release
Change-Id: I6a11c969930398d7df5e29f63a156f0e108abbc2
-rw-r--r-- | library/main/src/com/android/setupwizardlib/util/Partner.java | 2 | ||||
-rw-r--r-- | library/test/robotest/src/com/android/setupwizardlib/util/PartnerTest.java | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/library/main/src/com/android/setupwizardlib/util/Partner.java b/library/main/src/com/android/setupwizardlib/util/Partner.java index 3a603ee..baf66d1 100644 --- a/library/main/src/com/android/setupwizardlib/util/Partner.java +++ b/library/main/src/com/android/setupwizardlib/util/Partner.java @@ -91,7 +91,7 @@ public class Partner { */ public static CharSequence getText(Context context, @StringRes int id) { final ResourceEntry entry = getResourceEntry(context, id); - return entry.resources.getText(id); + return entry.resources.getText(entry.id); } /** diff --git a/library/test/robotest/src/com/android/setupwizardlib/util/PartnerTest.java b/library/test/robotest/src/com/android/setupwizardlib/util/PartnerTest.java index f8e71be..2285cd5 100644 --- a/library/test/robotest/src/com/android/setupwizardlib/util/PartnerTest.java +++ b/library/test/robotest/src/com/android/setupwizardlib/util/PartnerTest.java @@ -16,6 +16,8 @@ package com.android.setupwizardlib.util; +import static com.google.common.truth.Truth.assertThat; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -146,6 +148,19 @@ public class PartnerTest { } @Test + public void getText_shouldReturnPartnerValueIfPresent() { + final CharSequence expectedPartnerText = "partner"; + doReturn(12345).when(mPartnerResources) + .getIdentifier(eq("suw_next_button_label"), eq("string"), anyString()); + doReturn(expectedPartnerText).when(mPartnerResources).getText(eq(12345)); + mPackageManager.addResolveInfoForIntent( + new Intent(ACTION_PARTNER_CUSTOMIZATION), + Collections.singletonList(createResolveInfo("test.partner.package", true, true))); + final CharSequence partnerText = Partner.getText(mContext, R.string.suw_next_button_label); + assertThat(partnerText).isEqualTo(expectedPartnerText); + } + + @Test public void testLoadDefaultValue() { mPackageManager.addResolveInfoForIntent( new Intent(ACTION_PARTNER_CUSTOMIZATION), |