@Test public void testChargingState() { Assert.assertFalse(powerTracker.isCharging()); shadowApplication.sendBroadcast(new Intent(Intent.ACTION_POWER_CONNECTED)); Assert.assertTrue(powerTracker.isCharging()); verify(mockListener).onChargingStateChanged(); reset(mockListener); shadowApplication.sendBroadcast(new Intent(Intent.ACTION_POWER_DISCONNECTED)); Assert.assertFalse(powerTracker.isCharging()); verify(mockListener).onChargingStateChanged(); }
public boolean isCharging() { return mIsCharging.get(); }
PowerTracker { public boolean isCharging() { return mIsCharging.get(); } }
PowerTracker { public boolean isCharging() { return mIsCharging.get(); } PowerTracker(Context context, PowerManager powerManager); }
PowerTracker { public boolean isCharging() { return mIsCharging.get(); } PowerTracker(Context context, PowerManager powerManager); void onBootCompleted(); void addListener(Listener listener); boolean isInPowerSave(); boolean isCharging(); boolean isDeviceIdle(); void dump(IndentingPrintWriter ipw); }
PowerTracker { public boolean isCharging() { return mIsCharging.get(); } PowerTracker(Context context, PowerManager powerManager); void onBootCompleted(); void addListener(Listener listener); boolean isInPowerSave(); boolean isCharging(); boolean isDeviceIdle(); void dump(IndentingPrintWriter ipw);  }