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

Commit abded113 authored by Joe Onorato's avatar Joe Onorato
Browse files

Add unit tests for BatteryStatsImpl.

- Add a Clocks interface to wrap SystemClock.uptimeMillis and
  SystemClock.elapsedRealtime.
- Make the inner classes static so they can be created independently,
  which meant passing explicit pointers to the BatteryStatsImpl and
  the Uid objects in a lot of places.
- Make several fields protected so they can be accessed by the tests (they are
  still @hidden)
- Add a test suite for the battery stats.
- Add the tests

Change-Id: I4e45afedc64f7050985c28a7eb4f5c1ddbaa63fa
parent 0c484107
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -623,7 +623,7 @@ public abstract class BatteryStats implements Parcelable {
            /**
            /**
             * The statistics associated with a particular service.
             * The statistics associated with a particular service.
             */
             */
            public abstract class Serv {
            public static abstract class Serv {


                /**
                /**
                 * Returns the amount of time spent started.
                 * Returns the amount of time spent started.
+615 −472

File changed.

Preview size limit exceeded, changes collapsed.

+745 −0

File added.

Preview size limit exceeded, changes collapsed.

+15 −0
Original line number Original line Diff line number Diff line
package com.android.internal.os;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({
        BatteryStatsServTest.class,
        BatteryStatsTimeBaseTest.class,
        BatteryStatsTimerTest.class,
        BatteryStatsUidTest.class,
    })
public class BatteryStatsTests {
}
+339 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading