diff options
author | Bill Yi <byi@google.com> | 2018-10-19 12:20:39 -0700 |
---|---|---|
committer | Bill Yi <byi@google.com> | 2018-10-19 12:20:39 -0700 |
commit | e0b88340379aaeaa11d6b92b7a61367ee3384e72 (patch) | |
tree | ae26c813f338cbe1f2908d9a50fffc2c608352e6 | |
parent | d533ee27e43ecf08f68abaa5a8b4741a5249b3cf (diff) | |
parent | 216850a04926481f3e4315d6ff594aa214421d30 (diff) | |
download | setupwizard-e0b88340379aaeaa11d6b92b7a61367ee3384e72.tar.gz |
Merge pi-dr1-dev to aosp-master
Change-Id: Ib3a9fd64b6d49cecea33947cf2a1e3a0c100d4c7
-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 f3e07aa..9eaedc3 100644 --- a/library/main/src/com/android/setupwizardlib/util/Partner.java +++ b/library/main/src/com/android/setupwizardlib/util/Partner.java @@ -92,7 +92,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), |