Stricter NetworkNotificationManagerTest
This patch changes NetworkNotificationManagerTest to populate extraInfo
of NetworkInfo in order to catch regressions in malformed format Strings
of log statements in NetworkNotificationManager.
Test: verified that the test fails when reintroducing the format String
bug.
Bug: 33737715
(cherry picked from commit 3cb1d2b45d)
Change-Id: Ic2f23e860a17cb83b90edcfd2ba365134cacfe36
This commit is contained in:
@@ -182,7 +182,7 @@ public class NetworkNotificationManager {
|
|||||||
details = r.getString(R.string.network_switch_metered_detail, toTransport,
|
details = r.getString(R.string.network_switch_metered_detail, toTransport,
|
||||||
fromTransport);
|
fromTransport);
|
||||||
} else {
|
} else {
|
||||||
Slog.wtf(TAG, "Unknown notification type " + notifyType + "on network transport "
|
Slog.wtf(TAG, "Unknown notification type " + notifyType + " on network transport "
|
||||||
+ getTransportName(transportType));
|
+ getTransportName(transportType));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public class NetworkNotificationManagerTest extends TestCase {
|
|||||||
when(mCtx.getResources()).thenReturn(mResources);
|
when(mCtx.getResources()).thenReturn(mResources);
|
||||||
when(mCtx.getPackageManager()).thenReturn(mPm);
|
when(mCtx.getPackageManager()).thenReturn(mPm);
|
||||||
when(mCtx.getApplicationInfo()).thenReturn(new ApplicationInfo());
|
when(mCtx.getApplicationInfo()).thenReturn(new ApplicationInfo());
|
||||||
|
when(mNetworkInfo.getExtraInfo()).thenReturn("extra");
|
||||||
when(mResources.getColor(anyInt(), any())).thenReturn(0xFF607D8B);
|
when(mResources.getColor(anyInt(), any())).thenReturn(0xFF607D8B);
|
||||||
|
|
||||||
mManager = new NetworkNotificationManager(mCtx, mTelephonyManager, mNotificationManager);
|
mManager = new NetworkNotificationManager(mCtx, mTelephonyManager, mNotificationManager);
|
||||||
|
|||||||
Reference in New Issue
Block a user