diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index 337bad7..9b2e97f 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -72,10 +72,11 @@
 
     static_libs: [
         "SettingsLib-robo-testutils",
-	"android-support-annotations",
+        "android-support-annotations",
         "androidx.test.core",
         "androidx.test.runner",
         "androidx.test.ext.junit",
+        "androidx.test.espresso.core",
     ],
 
     libs: [
diff --git a/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java b/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
index 5c3dacd..6acc72f 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
@@ -21,7 +21,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.mock;
@@ -31,7 +30,6 @@
 import android.app.Activity;
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
-import android.content.Intent;
 import android.content.pm.UserInfo;
 import android.os.Process;
 import android.os.UserHandle;
@@ -43,8 +41,6 @@
 import androidx.appcompat.app.AlertDialog;
 
 import com.android.settings.R;
-import com.android.settings.Settings;
-import com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd;
 import com.android.settings.testutils.CustomActivity;
 import com.android.settings.testutils.shadow.ShadowActivity;
 import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
@@ -69,6 +65,11 @@
         ShadowActivity.class
 })
 public class ActionDisabledByAdminDialogHelperTest {
+    private static final ComponentName ADMIN_COMPONENT =
+            new ComponentName("some.package.name", "some.package.name.SomeClass");
+    private static final int USER_ID = 123;
+    private static final EnforcedAdmin ENFORCED_ADMIN =
+            new EnforcedAdmin(ADMIN_COMPONENT, UserHandle.of(USER_ID));
     private ActionDisabledByAdminDialogHelper mHelper;
     private Activity mActivity;
     private org.robolectric.shadows.ShadowActivity mActivityShadow;
@@ -81,32 +82,6 @@
     }
 
     @Test
-    public void testShowAdminPoliciesWithComponent() {
-        final int userId = 123;
-        final ComponentName component = new ComponentName("some.package.name",
-                "some.package.name.SomeClass");
-        final EnforcedAdmin admin = new EnforcedAdmin(component, UserHandle.of(userId));
-
-        mHelper.showAdminPolicies(admin, mActivity);
-
-        final Intent intent = mActivityShadow.getNextStartedActivity();
-        assertTrue(
-                intent.getBooleanExtra(DeviceAdminAdd.EXTRA_CALLED_FROM_SUPPORT_DIALOG, false));
-        assertEquals(component,
-                intent.getParcelableExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN));
-    }
-
-    @Test
-    public void testShowAdminPoliciesWithoutComponent() {
-        final int userId = 123;
-        final EnforcedAdmin admin = new EnforcedAdmin(null, UserHandle.of(userId));
-        mHelper.showAdminPolicies(admin, mActivity);
-        final Intent intent = mActivityShadow.getNextStartedActivity();
-        assertEquals(intent.getComponent(), new ComponentName(mActivity,
-                Settings.DeviceAdminSettingsActivity.class.getName()));
-    }
-
-    @Test
     public void testSetAdminSupportTitle() {
         final ViewGroup view = new FrameLayout(mActivity);
         final TextView textView = createAdminSupportDialogTitleTextView(view, mActivity);
@@ -150,6 +125,7 @@
         final ViewGroup view = new FrameLayout(mActivity);
         final TextView textView = createAdminSupportDialogTitleTextView(view, mActivity);
         setupFinancedDevice(dpmShadow);
+        mHelper = new ActionDisabledByAdminDialogHelper(mActivity);
 
         mHelper.setAdminSupportTitle(view, null);
 
@@ -196,7 +172,8 @@
         mHelper.setAdminSupportDetails(mActivity, view, admin);
 
         assertNotNull(admin.component);
-        assertEquals("", Shadows.shadowOf(textView).innerText());
+        assertEquals(mActivity.getString(R.string.default_admin_support_msg),
+                Shadows.shadowOf(textView).innerText());
     }
 
     @Test
@@ -217,7 +194,8 @@
         mHelper.setAdminSupportDetails(mActivity, textView, admin);
 
         assertNull(admin.component);
-        assertEquals("", Shadows.shadowOf(textView).innerText());
+        assertEquals(mActivity.getString(R.string.default_admin_support_msg),
+                Shadows.shadowOf(textView).innerText());
     }
 
     @Test
@@ -225,12 +203,11 @@
         final UserManager userManager = RuntimeEnvironment.application.getSystemService(
                 UserManager.class);
         final ShadowUserManager userManagerShadow = Shadow.extract(userManager);
-        final ComponentName component = new ComponentName("some.package.name",
-                "some.package.name.SomeClass");
-        mHelper.mEnforcedAdmin = new EnforcedAdmin(component, UserHandle.of(123));
+        mHelper.prepareDialogBuilder(
+                /* restriction= */ null, ENFORCED_ADMIN);
 
         // Set up for shadow call.
-        userManagerShadow.getSameProfileGroupIds().put(123, 0);
+        userManagerShadow.getSameProfileGroupIds().put(USER_ID, 0);
 
         // Test that the button is shown when user IDs are in the same profile group
         AlertDialog.Builder builder = mock(AlertDialog.Builder.class);
diff --git a/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java b/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
new file mode 100644
index 0000000..68468ed
--- /dev/null
+++ b/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2021 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 com.android.settings.enterprise;
+
+import static android.app.admin.DevicePolicyManager.EXTRA_DEVICE_ADMIN;
+
+import static com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd.EXTRA_CALLED_FROM_SUPPORT_DIALOG;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.UserHandle;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.settings.Settings;
+import com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminAdd;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+
+@RunWith(AndroidJUnit4.class)
+public class ActionDisabledLearnMoreButtonLauncherImplTest {
+
+    private static final int ENFORCED_ADMIN_USER_ID = 123;
+    private static final ComponentName ADMIN_COMPONENT =
+            new ComponentName("some.package.name", "some.package.name.SomeClass");
+    private static final String URL = "https://testexample.com";
+    private static final Uri URI = Uri.parse(URL);
+
+    @Mock
+    private Activity mActivity;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    @Test
+    public void showAdminPolicies_noComponent_works() {
+        final EnforcedAdmin enforcedAdmin = createEnforcedAdmin(/* component= */ null);
+
+        ActionDisabledLearnMoreButtonLauncherImpl.SHOW_ADMIN_POLICIES
+                .accept(mActivity, enforcedAdmin);
+
+        final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+        verify(mActivity).startActivity(captor.capture());
+        assertThat(captor.getValue().getComponent().getClassName())
+                .isEqualTo(Settings.DeviceAdminSettingsActivity.class.getName());
+    }
+
+    @Test
+    public void showAdminPolicies_withComponent_works() {
+        final EnforcedAdmin enforcedAdmin = createEnforcedAdmin(ADMIN_COMPONENT);
+
+        ActionDisabledLearnMoreButtonLauncherImpl.SHOW_ADMIN_POLICIES
+                .accept(mActivity, enforcedAdmin);
+
+        final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+        verify(mActivity).startActivityAsUser(
+                captor.capture(),
+                eq(UserHandle.of(ENFORCED_ADMIN_USER_ID)));
+        assertDeviceAdminAddIntent(captor.getValue());
+    }
+
+    @Test
+    public void launchHelpPage_works() {
+        ActionDisabledLearnMoreButtonLauncherImpl.LAUNCH_HELP_PAGE.accept(mActivity, URL);
+
+        final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
+        verify(mActivity).startActivityAsUser(captor.capture(), eq(UserHandle.SYSTEM));
+        assertActionViewIntent(captor.getValue());
+    }
+
+    private EnforcedAdmin createEnforcedAdmin(ComponentName component) {
+        return new RestrictedLockUtils.EnforcedAdmin(
+                component, UserHandle.of(ENFORCED_ADMIN_USER_ID));
+    }
+
+    private void assertDeviceAdminAddIntent(Intent intent) {
+        assertThat(intent.getComponent().getClassName())
+                .isEqualTo(DeviceAdminAdd.class.getName());
+        assertThat((ComponentName) intent.getParcelableExtra(EXTRA_DEVICE_ADMIN))
+                .isEqualTo(ADMIN_COMPONENT);
+        assertThat(intent.getBooleanExtra(
+                EXTRA_CALLED_FROM_SUPPORT_DIALOG,
+                /* defaultValue= */ false))
+                .isTrue();
+    }
+
+    private void assertActionViewIntent(Intent intent) {
+        assertThat(intent.getAction())
+                .isEqualTo(Intent.ACTION_VIEW);
+        assertThat(intent.getData())
+                .isEqualTo(URI);
+    }
+}
