Merge "Update language to comply with Android’s inclusive language guidance" am: f366f37aa1

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1372976

Change-Id: Iccc3389dfc0ee64f819dd9c2d9bf7ca78f0a1490
This commit is contained in:
Treehugger Robot
2020-07-27 05:37:31 +00:00
committed by Automerger Merge Worker
2 changed files with 24 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- testFromJsonString -->
<string name="blacklist_json_string" translatable="false">
<string name="blocklist_json_string" translatable="false">
{
\"entries\":[
{

View File

@@ -47,32 +47,32 @@ public class KeyRevocationListTest {
private static Context sContext;
private static String sBlacklistJsonString;
private static String sBlocklistJsonString;
@BeforeClass
public static void setUpClass() throws Exception {
sContext = InstrumentationRegistry.getInstrumentation().getContext();
sBlacklistJsonString =
sContext.getString(com.android.dynsystem.tests.R.string.blacklist_json_string);
sBlocklistJsonString =
sContext.getString(com.android.dynsystem.tests.R.string.blocklist_json_string);
}
@Test
@SmallTest
public void testFromJsonString() throws JSONException {
KeyRevocationList blacklist;
blacklist = KeyRevocationList.fromJsonString(sBlacklistJsonString);
Assert.assertNotNull(blacklist);
Assert.assertFalse(blacklist.mEntries.isEmpty());
blacklist = KeyRevocationList.fromJsonString("{}");
Assert.assertNotNull(blacklist);
Assert.assertTrue(blacklist.mEntries.isEmpty());
KeyRevocationList blocklist;
blocklist = KeyRevocationList.fromJsonString(sBlocklistJsonString);
Assert.assertNotNull(blocklist);
Assert.assertFalse(blocklist.mEntries.isEmpty());
blocklist = KeyRevocationList.fromJsonString("{}");
Assert.assertNotNull(blocklist);
Assert.assertTrue(blocklist.mEntries.isEmpty());
}
@Test
@SmallTest
public void testFromUrl() throws IOException, JSONException {
URLConnection mockConnection = mock(URLConnection.class);
doReturn(new ByteArrayInputStream(sBlacklistJsonString.getBytes()))
doReturn(new ByteArrayInputStream(sBlocklistJsonString.getBytes()))
.when(mockConnection).getInputStream();
URL mockUrl = new URL(
"http", // protocol
@@ -97,36 +97,36 @@ public class KeyRevocationListTest {
}
});
KeyRevocationList blacklist = KeyRevocationList.fromUrl(mockUrl);
Assert.assertNotNull(blacklist);
Assert.assertFalse(blacklist.mEntries.isEmpty());
KeyRevocationList blocklist = KeyRevocationList.fromUrl(mockUrl);
Assert.assertNotNull(blocklist);
Assert.assertFalse(blocklist.mEntries.isEmpty());
blacklist = null;
blocklist = null;
try {
blacklist = KeyRevocationList.fromUrl(mockBadUrl);
blocklist = KeyRevocationList.fromUrl(mockBadUrl);
// Up should throw, down should be unreachable
Assert.fail("Expected IOException not thrown");
} catch (IOException e) {
// This is expected, do nothing
}
Assert.assertNull(blacklist);
Assert.assertNull(blocklist);
}
@Test
@SmallTest
public void testIsRevoked() {
KeyRevocationList blacklist = new KeyRevocationList();
blacklist.addEntry("key1", "REVOKED", "reason for key1");
KeyRevocationList blocklist = new KeyRevocationList();
blocklist.addEntry("key1", "REVOKED", "reason for key1");
KeyRevocationList.RevocationStatus revocationStatus =
blacklist.getRevocationStatusForKey("key1");
blocklist.getRevocationStatusForKey("key1");
Assert.assertNotNull(revocationStatus);
Assert.assertEquals(revocationStatus.mReason, "reason for key1");
revocationStatus = blacklist.getRevocationStatusForKey("key2");
revocationStatus = blocklist.getRevocationStatusForKey("key2");
Assert.assertNull(revocationStatus);
Assert.assertTrue(blacklist.isRevoked("key1"));
Assert.assertFalse(blacklist.isRevoked("key2"));
Assert.assertTrue(blocklist.isRevoked("key1"));
Assert.assertFalse(blocklist.isRevoked("key2"));
}
}