Merge "Delete test files to help fix merge conflict as per https://android-build.googleplex.com/builds/pending/P51286909/androidx_host_tests/latest/view/logs/git.log" into androidx-main
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionPrivilegedFailureInputsJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionPrivilegedFailureInputsJavaTest.java
deleted file mode 100644
index be01f1c..0000000
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionPrivilegedFailureInputsJavaTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.credentials;
-
-import static org.junit.Assert.assertThrows;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Arrays;
-
-/**
- * Combines with {@link GetPublicKeyCredentialOptionPrivilegedJavaTest} for full tests.
- */
-@RunWith(Parameterized.class)
-public class GetPublicKeyCredentialOptionPrivilegedFailureInputsJavaTest {
-    private String mRequestJson;
-    private String mRp;
-    private String mClientDataHash;
-
-    private String mNullRequestJson;
-    private String mNullRp;
-    private String mNullClientDataHash;
-
-    public GetPublicKeyCredentialOptionPrivilegedFailureInputsJavaTest(String requestJson,
-            String rp, String clientDataHash, String mNullRequestJson, String mNullRp,
-            String mNullClientDataHash) {
-        this.mRequestJson = requestJson;
-        this.mRp = rp;
-        this.mClientDataHash = clientDataHash;
-        this.mNullRequestJson = mNullRequestJson;
-        this.mNullRp = mNullRp;
-        this.mNullClientDataHash = mNullClientDataHash;
-    }
-
-    @Parameterized.Parameters
-    public static Iterable<String[]> failureCases() {
-        // Allows checking improper formations for builder and normal construction.
-        // Handles both null and empty cases.
-        // For successful cases, see the non parameterized privileged tests.
-        return Arrays.asList(new String[][] {
-                { "{\"hi\":21}", "rp", "", null, "rp", "hash"},
-                { "", "rp", "clientDataHash", "{\"hi\":21}", null, "hash"},
-                { "{\"hi\":21}", "", "clientDataHash", "{\"hi\":21}", "rp", null}
-        });
-    }
-
-    @Test
-    public void constructor_emptyInput_throwsIllegalArgumentException() {
-        assertThrows("If at least one arg empty, should throw IllegalArgumentException",
-                IllegalArgumentException.class,
-                () -> new GetPublicKeyCredentialOptionPrivileged(this.mRequestJson, this.mRp,
-                        this.mClientDataHash)
-        );
-    }
-
-    @Test
-    public void builder_build_emptyInput_IllegalArgumentException() {
-        GetPublicKeyCredentialOptionPrivileged.Builder builder =
-                new GetPublicKeyCredentialOptionPrivileged.Builder(mRequestJson, mRp,
-                        mClientDataHash);
-        assertThrows("If at least one arg empty to builder, should throw "
-                        + "IllegalArgumentException",
-                IllegalArgumentException.class,
-                () -> builder.build()
-        );
-    }
-
-    @Test
-    public void constructor_nullInput_throwsNullPointerException() {
-        convertAPIIssueToProperNull();
-        assertThrows(
-                "If at least one arg null, should throw NullPointerException",
-                NullPointerException.class,
-                () -> new GetPublicKeyCredentialOptionPrivileged(this.mNullRequestJson,
-                        this.mNullRp,
-                        this.mNullClientDataHash)
-        );
-    }
-
-    @Test
-    public void builder_build_nullInput_throwsNullPointerException() {
-        convertAPIIssueToProperNull();
-        assertThrows(
-                "If at least one arg null to builder, should throw NullPointerException",
-                NullPointerException.class,
-                () -> new GetPublicKeyCredentialOptionPrivileged.Builder(mNullRequestJson,
-                        mNullRp, mNullClientDataHash).build()
-        );
-    }
-
-    // Certain API levels have parameterized tests that automatically convert null to a string
-    // 'null' causing test failures. Until Parameterized tests fixes this bug, this is the
-    // workaround. Note this is *not* always the case but only for certain API levels (we have
-    // recorded 21, 22, and 23 as such levels).
-    private void convertAPIIssueToProperNull() {
-        if (mNullRequestJson != null && mNullRequestJson.equals("null")) {
-            mNullRequestJson = null;
-        }
-        if (mNullRp != null && mNullRp.equals("null")) {
-            mNullRp = null;
-        }
-        if (mNullClientDataHash != null && mNullClientDataHash.equals("null")) {
-            mNullClientDataHash = null;
-        }
-    }
-}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionPrivilegedJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionPrivilegedJavaTest.java
deleted file mode 100644
index 15bb0cb..0000000
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionPrivilegedJavaTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.credentials;
-
-import static androidx.credentials.CredentialOption.BUNDLE_KEY_IS_AUTO_SELECT_ALLOWED;
-import static androidx.credentials.GetPublicKeyCredentialOptionPrivileged.BUNDLE_KEY_CLIENT_DATA_HASH;
-import static androidx.credentials.GetPublicKeyCredentialOptionPrivileged.BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS;
-import static androidx.credentials.GetPublicKeyCredentialOptionPrivileged.BUNDLE_KEY_RELYING_PARTY;
-import static androidx.credentials.GetPublicKeyCredentialOptionPrivileged.BUNDLE_KEY_REQUEST_JSON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.os.Bundle;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.SmallTest;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Combines with {@link GetPublicKeyCredentialOptionPrivilegedFailureInputsJavaTest}
- * for full tests.
- */
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class GetPublicKeyCredentialOptionPrivilegedJavaTest {
-
-    @Test
-    public void constructor_success() {
-        new GetPublicKeyCredentialOptionPrivileged(
-                "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}",
-                "RelyingParty", "ClientDataHash");
-    }
-
-    @Test
-    public void constructor_setPreferImmediatelyAvailableCredentialsToFalseByDefault() {
-        GetPublicKeyCredentialOptionPrivileged getPublicKeyCredentialOptionPrivileged =
-                new GetPublicKeyCredentialOptionPrivileged(
-                        "JSON", "RelyingParty", "HASH");
-        boolean preferImmediatelyAvailableCredentialsActual =
-                getPublicKeyCredentialOptionPrivileged.preferImmediatelyAvailableCredentials();
-        assertThat(preferImmediatelyAvailableCredentialsActual).isFalse();
-    }
-
-    @Test
-    public void constructor_setPreferImmediatelyAvailableCredentialsTrue() {
-        boolean preferImmediatelyAvailableCredentialsExpected = true;
-        GetPublicKeyCredentialOptionPrivileged getPublicKeyCredentialOptionPrivileged =
-                new GetPublicKeyCredentialOptionPrivileged(
-                        "testJson",
-                        "RelyingParty",
-                        "Hash",
-                        preferImmediatelyAvailableCredentialsExpected
-                );
-        boolean preferImmediatelyAvailableCredentialsActual =
-                getPublicKeyCredentialOptionPrivileged.preferImmediatelyAvailableCredentials();
-        assertThat(preferImmediatelyAvailableCredentialsActual).isEqualTo(
-                preferImmediatelyAvailableCredentialsExpected);
-    }
-
-    @Test
-    public void builder_build_defaultPreferImmediatelyAvailableCredentials_success() {
-        GetPublicKeyCredentialOptionPrivileged defaultPrivilegedRequest = new
-                GetPublicKeyCredentialOptionPrivileged.Builder("{\"Data\":5}",
-                "RelyingParty", "HASH").build();
-        assertThat(defaultPrivilegedRequest.preferImmediatelyAvailableCredentials()).isFalse();
-    }
-
-    @Test
-    public void builder_build_nonDefaultPreferImmediatelyAvailableCredentials_success() {
-        boolean preferImmediatelyAvailableCredentialsExpected = true;
-        GetPublicKeyCredentialOptionPrivileged getPublicKeyCredentialOptionPrivileged =
-                new GetPublicKeyCredentialOptionPrivileged.Builder("testJson",
-                        "RelyingParty", "Hash")
-                        .setPreferImmediatelyAvailableCredentials(
-                                preferImmediatelyAvailableCredentialsExpected).build();
-        boolean preferImmediatelyAvailableCredentialsActual =
-                getPublicKeyCredentialOptionPrivileged.preferImmediatelyAvailableCredentials();
-        assertThat(preferImmediatelyAvailableCredentialsActual).isEqualTo(
-                preferImmediatelyAvailableCredentialsExpected);
-    }
-
-    @Test
-    public void getter_requestJson_success() {
-        String testJsonExpected = "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}";
-        GetPublicKeyCredentialOptionPrivileged getPublicKeyCredentialOptionPrivileged =
-                new GetPublicKeyCredentialOptionPrivileged(testJsonExpected,
-                        "RelyingParty", "HASH");
-        String testJsonActual = getPublicKeyCredentialOptionPrivileged.getRequestJson();
-        assertThat(testJsonActual).isEqualTo(testJsonExpected);
-    }
-
-    @Test
-    public void getter_relyingParty_success() {
-        String testRelyingPartyExpected = "RelyingParty";
-        GetPublicKeyCredentialOptionPrivileged getPublicKeyCredentialOptionPrivileged =
-                new GetPublicKeyCredentialOptionPrivileged(
-                        "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}",
-                        testRelyingPartyExpected, "X342%4dfd7&");
-        String testRelyingPartyActual = getPublicKeyCredentialOptionPrivileged.getRelyingParty();
-        assertThat(testRelyingPartyActual).isEqualTo(testRelyingPartyExpected);
-    }
-
-    @Test
-    public void getter_clientDataHash_success() {
-        String clientDataHashExpected = "X342%4dfd7&";
-        GetPublicKeyCredentialOptionPrivileged getPublicKeyCredentialOptionPrivileged =
-                new GetPublicKeyCredentialOptionPrivileged(
-                        "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}",
-                        "RelyingParty", clientDataHashExpected);
-        String clientDataHashActual = getPublicKeyCredentialOptionPrivileged.getClientDataHash();
-        assertThat(clientDataHashActual).isEqualTo(clientDataHashExpected);
-    }
-
-    @Test
-    public void getter_frameworkProperties_success() {
-        String requestJsonExpected = "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}";
-        String relyingPartyExpected = "RelyingParty";
-        String clientDataHashExpected = "X342%4dfd7&";
-        boolean preferImmediatelyAvailableCredentialsExpected = false;
-        boolean expectedIsAutoSelect = true;
-        Bundle expectedData = new Bundle();
-        expectedData.putString(
-                PublicKeyCredential.BUNDLE_KEY_SUBTYPE,
-                GetPublicKeyCredentialOptionPrivileged
-                        .BUNDLE_VALUE_SUBTYPE_GET_PUBLIC_KEY_CREDENTIAL_OPTION_PRIVILEGED);
-        expectedData.putString(BUNDLE_KEY_REQUEST_JSON, requestJsonExpected);
-        expectedData.putString(BUNDLE_KEY_RELYING_PARTY, relyingPartyExpected);
-        expectedData.putString(BUNDLE_KEY_CLIENT_DATA_HASH, clientDataHashExpected);
-        expectedData.putBoolean(BUNDLE_KEY_IS_AUTO_SELECT_ALLOWED, expectedIsAutoSelect);
-        expectedData.putBoolean(
-                BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS,
-                preferImmediatelyAvailableCredentialsExpected);
-
-        GetPublicKeyCredentialOptionPrivileged option =
-                new GetPublicKeyCredentialOptionPrivileged(
-                        requestJsonExpected, relyingPartyExpected, clientDataHashExpected,
-                        preferImmediatelyAvailableCredentialsExpected);
-
-        assertThat(option.getType()).isEqualTo(PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL);
-        assertThat(TestUtilsKt.equals(option.getRequestData(), expectedData)).isTrue();
-        expectedData.remove(BUNDLE_KEY_IS_AUTO_SELECT_ALLOWED);
-        assertThat(TestUtilsKt.equals(option.getCandidateQueryData(), expectedData)).isTrue();
-        assertThat(option.isSystemProviderRequired()).isFalse();
-    }
-
-    @Test
-    public void frameworkConversion_success() {
-        GetPublicKeyCredentialOptionPrivileged option =
-                new GetPublicKeyCredentialOptionPrivileged("json", "rp", "clientDataHash", true);
-
-        CredentialOption convertedOption = CredentialOption.createFrom(
-                option.getType(), option.getRequestData(),
-                option.getCandidateQueryData(), option.isSystemProviderRequired());
-
-        assertThat(convertedOption).isInstanceOf(GetPublicKeyCredentialOptionPrivileged.class);
-        GetPublicKeyCredentialOptionPrivileged convertedSubclassOption =
-                (GetPublicKeyCredentialOptionPrivileged) convertedOption;
-        assertThat(convertedSubclassOption.getRequestJson()).isEqualTo(option.getRequestJson());
-        assertThat(convertedSubclassOption.preferImmediatelyAvailableCredentials()).isEqualTo(
-                option.preferImmediatelyAvailableCredentials());
-        assertThat(convertedSubclassOption.getClientDataHash())
-                .isEqualTo(option.getClientDataHash());
-        assertThat(convertedSubclassOption.getRelyingParty()).isEqualTo(option.getRelyingParty());
-    }
-}