diff options
Diffstat (limited to 'services/tests/servicestests/src')
2 files changed, 19 insertions, 6 deletions
diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java index 9b371ac..c23e868 100644 --- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java @@ -37,6 +37,7 @@ import static com.android.server.net.NetworkPolicyManagerService.TYPE_LIMIT; import static com.android.server.net.NetworkPolicyManagerService.TYPE_LIMIT_SNOOZED; import static com.android.server.net.NetworkPolicyManagerService.TYPE_WARNING; import static org.easymock.EasyMock.anyInt; +import static org.easymock.EasyMock.anyLong; import static org.easymock.EasyMock.aryEq; import static org.easymock.EasyMock.capture; import static org.easymock.EasyMock.createMock; @@ -229,6 +230,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { // expect to answer screen status during systemReady() expect(mPowerManager.isScreenOn()).andReturn(true).atLeastOnce(); + expect(mNetworkManager.isBandwidthControlEnabled()).andReturn(true).atLeastOnce(); expectCurrentTime(); replay(); @@ -613,6 +615,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { expect(mConnManager.getAllNetworkState()).andReturn(state).atLeastOnce(); expectCurrentTime(); expectClearNotifications(); + expectAdvisePersistThreshold(); future = expectMeteredIfacesChanged(); replay(); @@ -637,6 +640,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { expectSetInterfaceQuota(TEST_IFACE, (2 * MB_IN_BYTES) - 512); expectClearNotifications(); + expectAdvisePersistThreshold(); future = expectMeteredIfacesChanged(TEST_IFACE); replay(); @@ -704,6 +708,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { expectPolicyDataEnable(TYPE_WIFI, true); expectClearNotifications(); + expectAdvisePersistThreshold(); future = expectMeteredIfacesChanged(); replay(); @@ -730,6 +735,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { expectSetInterfaceQuota(TEST_IFACE, 2 * MB_IN_BYTES); expectClearNotifications(); + expectAdvisePersistThreshold(); future = expectMeteredIfacesChanged(TEST_IFACE); replay(); @@ -794,6 +800,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { // still restricted. expectRemoveInterfaceQuota(TEST_IFACE); expectSetInterfaceQuota(TEST_IFACE, Long.MAX_VALUE); + expectAdvisePersistThreshold(); expectMeteredIfacesChanged(TEST_IFACE); future = expectClearNotifications(); @@ -835,6 +842,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { expectSetInterfaceQuota(TEST_IFACE, Long.MAX_VALUE); expectClearNotifications(); + expectAdvisePersistThreshold(); future = expectMeteredIfacesChanged(TEST_IFACE); replay(); @@ -943,6 +951,11 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { return future; } + private void expectAdvisePersistThreshold() throws Exception { + mStatsService.advisePersistThreshold(anyLong()); + expectLastCall().anyTimes(); + } + private static class TestAbstractFuture<T> extends AbstractFuture<T> { @Override public T get() throws InterruptedException, ExecutionException { diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java index e40f166..8634821 100644 --- a/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java +++ b/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java @@ -43,7 +43,7 @@ import libcore.io.Streams; */ @MediumTest public class NetworkStatsCollectionTest extends AndroidTestCase { - + private static final String TEST_FILE = "test.bin"; private static final String TEST_IMSI = "310260000000000"; @@ -53,10 +53,10 @@ public class NetworkStatsCollectionTest extends AndroidTestCase { final NetworkStatsCollection collection = new NetworkStatsCollection(30 * MINUTE_IN_MILLIS); collection.readLegacyNetwork(testFile); - + // verify that history read correctly assertSummaryTotal(collection, buildTemplateMobileAll(TEST_IMSI), - 636014522L, 709291L, 88037144L, 518820L); + 636016770L, 709306L, 88038768L, 518836L); // now export into a unified format final ByteArrayOutputStream bos = new ByteArrayOutputStream(); @@ -70,7 +70,7 @@ public class NetworkStatsCollectionTest extends AndroidTestCase { // and read back into structure, verifying that totals are same collection.read(new ByteArrayInputStream(bos.toByteArray())); assertSummaryTotal(collection, buildTemplateMobileAll(TEST_IMSI), - 636014522L, 709291L, 88037144L, 518820L); + 636016770L, 709306L, 88038768L, 518836L); } public void testReadLegacyUid() throws Exception { @@ -82,7 +82,7 @@ public class NetworkStatsCollectionTest extends AndroidTestCase { // verify that history read correctly assertSummaryTotal(collection, buildTemplateMobileAll(TEST_IMSI), - 637073904L, 711398L, 88342093L, 521006L); + 637076152L, 711413L, 88343717L, 521022L); // now export into a unified format final ByteArrayOutputStream bos = new ByteArrayOutputStream(); @@ -96,7 +96,7 @@ public class NetworkStatsCollectionTest extends AndroidTestCase { // and read back into structure, verifying that totals are same collection.read(new ByteArrayInputStream(bos.toByteArray())); assertSummaryTotal(collection, buildTemplateMobileAll(TEST_IMSI), - 637073904L, 711398L, 88342093L, 521006L); + 637076152L, 711413L, 88343717L, 521022L); } public void testReadLegacyUidTags() throws Exception { |