Loading services/tests/mockingservicestests/src/com/android/server/app/GameManagerServiceTests.java +7 −7 Original line number Original line Diff line number Diff line Loading @@ -537,7 +537,7 @@ public class GameManagerServiceTests { } } /** /** * Test permission.MANAGE_GAME_MODE is checked * Test invalid package name is queried */ */ @Test @Test public void testGetGameModeInvalidPackageName() { public void testGetGameModeInvalidPackageName() { Loading @@ -546,16 +546,16 @@ public class GameManagerServiceTests { startUser(gameManagerService, USER_ID_1); startUser(gameManagerService, USER_ID_1); try { try { when(mMockPackageManager.getApplicationInfoAsUser(anyString(), anyInt(), anyInt())) .thenThrow(new PackageManager.NameNotFoundException()); assertEquals(GameManager.GAME_MODE_UNSUPPORTED, assertEquals(GameManager.GAME_MODE_UNSUPPORTED, gameManagerService.getGameMode(PACKAGE_NAME_INVALID, gameManagerService.getGameMode(PACKAGE_NAME_INVALID, USER_ID_1)); USER_ID_1)); } catch (PackageManager.NameNotFoundException e) { fail("GameManagerService failed to generate SecurityException when " // should never get here as isPackageGame() catches this exception + "permission.MANAGE_GAME_MODE is not granted."); // fail this test if we ever get here } catch (SecurityException ignored) { fail("Unexpected NameNotFoundException caught."); } } // The test should throw an exception, so the test is passing if we get here. } } /** /** Loading Loading
services/tests/mockingservicestests/src/com/android/server/app/GameManagerServiceTests.java +7 −7 Original line number Original line Diff line number Diff line Loading @@ -537,7 +537,7 @@ public class GameManagerServiceTests { } } /** /** * Test permission.MANAGE_GAME_MODE is checked * Test invalid package name is queried */ */ @Test @Test public void testGetGameModeInvalidPackageName() { public void testGetGameModeInvalidPackageName() { Loading @@ -546,16 +546,16 @@ public class GameManagerServiceTests { startUser(gameManagerService, USER_ID_1); startUser(gameManagerService, USER_ID_1); try { try { when(mMockPackageManager.getApplicationInfoAsUser(anyString(), anyInt(), anyInt())) .thenThrow(new PackageManager.NameNotFoundException()); assertEquals(GameManager.GAME_MODE_UNSUPPORTED, assertEquals(GameManager.GAME_MODE_UNSUPPORTED, gameManagerService.getGameMode(PACKAGE_NAME_INVALID, gameManagerService.getGameMode(PACKAGE_NAME_INVALID, USER_ID_1)); USER_ID_1)); } catch (PackageManager.NameNotFoundException e) { fail("GameManagerService failed to generate SecurityException when " // should never get here as isPackageGame() catches this exception + "permission.MANAGE_GAME_MODE is not granted."); // fail this test if we ever get here } catch (SecurityException ignored) { fail("Unexpected NameNotFoundException caught."); } } // The test should throw an exception, so the test is passing if we get here. } } /** /** Loading