Merge "Add userId to key when type is USER"

This commit is contained in:
TreeHugger Robot
2017-08-15 01:47:05 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 0 deletions

View File

@@ -313,6 +313,16 @@ public class PowerUsageSummaryTest {
assertThat(key).isEqualTo(mNormalBatterySipper.drainType.toString());
}
@Test
public void testExtractKeyFromSipper_typeUser_returnDrainTypeWithUserId() {
mNormalBatterySipper.uidObj = null;
mNormalBatterySipper.drainType = BatterySipper.DrainType.USER;
mNormalBatterySipper.userId = 2;
final String key = mFragment.extractKeyFromSipper(mNormalBatterySipper);
assertThat(key).isEqualTo("USER2");
}
@Test
public void testExtractKeyFromSipper_typeAPPUidObjectNotNull_returnUid() {
mNormalBatterySipper.uidObj = new BatteryStatsImpl.Uid(new BatteryStatsImpl(), UID);