1abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato/* 2abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * Copyright (C) 2016 The Android Open Source Project 3abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * 4abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * Licensed under the Apache License, Version 2.0 (the "License"); 5abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * you may not use this file except in compliance with the License. 6abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * You may obtain a copy of the License at 7abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * 8abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * http://www.apache.org/licenses/LICENSE-2.0 9abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * 10abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * Unless required by applicable law or agreed to in writing, software 11abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * distributed under the License is distributed on an "AS IS" BASIS, 12abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * See the License for the specific language governing permissions and 14abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * limitations under the License. 15abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato */ 16abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 17abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratopackage com.android.internal.os; 18abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 19abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport java.io.PrintWriter; 20abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport java.io.StringWriter; 21abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport java.util.ArrayList; 22abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 23abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport android.os.BatteryStats; 24abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport android.os.Parcel; 25abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport android.test.suitebuilder.annotation.SmallTest; 26abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport android.util.Log; 27abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 28abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport junit.framework.Assert; 29abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport junit.framework.TestCase; 30abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 31abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport com.android.internal.os.BatteryStatsImpl; 32abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 33abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratoimport org.mockito.Mockito; 34abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 35abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato/** 36abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato * Mocks a BatteryStatsImpl object. 37abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato */ 38abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onoratopublic class MockBatteryStatsImpl extends BatteryStatsImpl { 39abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato public BatteryStatsImpl.Clocks clocks; 40abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 41abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato MockBatteryStatsImpl() { 42abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato super(new MockClocks()); 43abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato this.clocks = mClocks; 44abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato } 45abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 46abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato public TimeBase getOnBatteryTimeBase() { 47abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato return mOnBatteryTimeBase; 48abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato } 49abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 50abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato} 51abded113bde548734600dc1b6e4ce2e94f48e32eJoe Onorato 52