Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d75676ed authored by Tony Huang's avatar Tony Huang
Browse files

Fine tune tests

1. Add DialogFragmentTest removed tests back.
2. Change its location to functional folder.
3. Rename it as DialogUiTest.
4. Set it as LargeTest.
5. Remove testOverlayPackagesForDocumentsUI_shouldBeMutable because
   isMutable field cannot find in mainline apk.

Bug: 150257481
Test: atest DocumentsUIGoogleTests
Change-Id: I82d42e56834cf49c1da557cd12dcc152e8b15924
parent 4505a178
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 * Copyright (C) 2020 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.
@@ -16,6 +16,8 @@

package com.android.documentsui;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@@ -29,7 +31,7 @@ import android.os.Build;
import android.os.ParcelFileDescriptor;

import androidx.fragment.app.FragmentManager;
import androidx.test.filters.MediumTest;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
@@ -54,9 +56,9 @@ import org.mockito.Mockito;
import java.io.FileInputStream;
import java.io.IOException;

@MediumTest
@LargeTest
@RunWith(AndroidJUnit4.class)
public class DialogFragmentTest {
public class DialogUiTest {

    private static final String CREATE_FRAGEMENT_TAG = "create_directory";
    CreateDirectoryFragment mCreateDirectoryFragment;
@@ -81,7 +83,7 @@ public class DialogFragmentTest {
        mCreateDirectoryFragment = null;
    }

/*    @Test
    @Test
    public void testCreateDialogShows() throws Throwable {
        mActivityTestRule.runOnUiThread(() -> CreateDirectoryFragment.show(mFragmentManager));
        InstrumentationRegistry.getInstrumentation().waitForIdleSync();
@@ -216,7 +218,7 @@ public class DialogFragmentTest {
        // called, so test pass means it skip.
        CreateDirectoryFragment.show(mFragmentManager);
    }
*/

    @Test
    public void testDeleteDocumentFragmentShows_skipWhenStateSaved() {
        mFragmentManager = Mockito.mock(FragmentManager.class);
+0 −12
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

@@ -90,17 +89,6 @@ public class ThemeOverlayManagerTest {
                createOverlayInfo(getOverlayPackageId(), getDisabledTargetPackageId(), false)));
    }

    @Test
    public void testOverlayPackagesForDocumentsUI_shouldBeMutable() {
        final String docsuiPkgId = mContext.getPackageName();
        final OverlayManager manager = mContext.getSystemService(OverlayManager.class);
        final List<OverlayInfo> infos = manager.getOverlayInfosForTarget(docsuiPkgId, mUserHandle);

        for (OverlayInfo info : infos) {
            assertThat(info.isMutable).isTrue();
        }
    }

    @Test
    public void testApplyOverlays_shouldSetEnabled() throws Exception {
        final boolean enabled = true;