Merge "Augment network stats based on SubscriptionPlan." into oc-mr1-dev

am: cf84220710

Change-Id: Ia6c6d5893d841f21d181363dc01f77efa6579a8f
This commit is contained in:
Jeff Sharkey
2017-08-30 19:14:21 +00:00
committed by android-build-merger
3 changed files with 302 additions and 55 deletions

View File

@@ -485,6 +485,21 @@ public class NetworkStatsHistoryTest extends AndroidTestCase {
assertTrue(stats.intersects(Long.MIN_VALUE, TEST_START + 1));
}
public void testSetValues() throws Exception {
stats = new NetworkStatsHistory(HOUR_IN_MILLIS);
stats.recordData(TEST_START, TEST_START + 1,
new NetworkStats.Entry(1024L, 10L, 2048L, 20L, 2L));
assertEquals(1024L + 2048L, stats.getTotalBytes());
final NetworkStatsHistory.Entry entry = stats.getValues(0, null);
entry.rxBytes /= 2;
entry.txBytes *= 2;
stats.setValues(0, entry);
assertEquals(512L + 4096L, stats.getTotalBytes());
}
private static void assertIndexBeforeAfter(
NetworkStatsHistory stats, int before, int after, long time) {
assertEquals("unexpected before", before, stats.getIndexBefore(time));