blob: cd104f8eb2c08f5bc69f79c6e1fc1e52a6f8b76d [file] [log] [blame]
Enrico Granata517a1e02017-09-20 16:15:50 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.car;
18
19import android.car.Car;
20import android.car.storagemonitoring.CarStorageMonitoringManager;
Enrico Granata1172f882017-09-21 14:51:30 -070021import android.car.storagemonitoring.WearEstimate;
Enrico Granata517a1e02017-09-20 16:15:50 -070022import android.test.suitebuilder.annotation.MediumTest;
23import com.android.car.storagemonitoring.WearInformation;
24
25/** Test the public entry points for the CarStorageMonitoringManager */
26@MediumTest
27public class CarStorageMonitoringTest extends MockedCarTestBase {
28 private static final String TAG = CarStorageMonitoringTest.class.getSimpleName();
29
Enrico Granata1172f882017-09-21 14:51:30 -070030 private static final WearInformation DEFAULT_WEAR_INFORMATION =
31 new WearInformation(10, 0, WearInformation.PRE_EOL_INFO_NORMAL);
32
Enrico Granata517a1e02017-09-20 16:15:50 -070033 private CarStorageMonitoringManager mCarStorageMonitoringManager;
34
35 @Override
36 protected synchronized void configureFakeSystemInterface() {
Enrico Granata1172f882017-09-21 14:51:30 -070037 setFlashWearInformation(DEFAULT_WEAR_INFORMATION);
Enrico Granata517a1e02017-09-20 16:15:50 -070038 }
39
40 @Override
41 protected void setUp() throws Exception {
42 super.setUp();
43
44 mCarStorageMonitoringManager =
45 (CarStorageMonitoringManager) getCar().getCarManager(Car.STORAGE_MONITORING_SERVICE);
46 }
47
48 public void testReadPreEolInformation() throws Exception {
Enrico Granata1172f882017-09-21 14:51:30 -070049 assertEquals(DEFAULT_WEAR_INFORMATION.preEolInfo,
Enrico Granata517a1e02017-09-20 16:15:50 -070050 mCarStorageMonitoringManager.getPreEolIndicatorStatus());
51 }
Enrico Granata1172f882017-09-21 14:51:30 -070052
53 public void testReadWearEstimate() throws Exception {
54 final WearEstimate wearEstimate = mCarStorageMonitoringManager.getWearEstimate();
55
56 assertNotNull(wearEstimate);
57 assertEquals(DEFAULT_WEAR_INFORMATION.lifetimeEstimateA, wearEstimate.typeA);
58 assertEquals(DEFAULT_WEAR_INFORMATION.lifetimeEstimateB, wearEstimate.typeB);
59 }
Enrico Granata517a1e02017-09-20 16:15:50 -070060}