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

Commit 63ff6e1b authored by Andy Yu's avatar Andy Yu
Browse files

Update testGetGameModeInvalidPackageName test

Previously this test verifies if the permission
permission.MANAGE_GAME_MODE is granted, which is already tested
in a separate test case. This patch updates the test to match
the test name.

Bug: 264528460
Test: atest GameManagerServiceTests
Change-Id: Ie4a8645633edc6aa32458571e2cc54f0ac5222e9
parent 8630254e
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -537,7 +537,7 @@ public class GameManagerServiceTests {
    }

    /**
     * Test permission.MANAGE_GAME_MODE is checked
     * Test invalid package name is queried
     */
    @Test
    public void testGetGameModeInvalidPackageName() {
@@ -546,16 +546,16 @@ public class GameManagerServiceTests {

        startUser(gameManagerService, USER_ID_1);
        try {
            when(mMockPackageManager.getApplicationInfoAsUser(anyString(), anyInt(), anyInt()))
                    .thenThrow(new PackageManager.NameNotFoundException());
            assertEquals(GameManager.GAME_MODE_UNSUPPORTED,
                    gameManagerService.getGameMode(PACKAGE_NAME_INVALID,
                            USER_ID_1));

            fail("GameManagerService failed to generate SecurityException when "
                    + "permission.MANAGE_GAME_MODE is not granted.");
        } catch (SecurityException ignored) {
        } catch (PackageManager.NameNotFoundException e) {
            // should never get here as isPackageGame() catches this exception
            // fail this test if we ever get here
            fail("Unexpected NameNotFoundException caught.");
        }

        // The test should throw an exception, so the test is passing if we get here.
    }

    /**