1 /*
2  * Copyright (C) 2013 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 
17 package com.android.cts.verifier.location;
18 
19 import android.location.LocationManager;
20 import android.provider.Settings.Secure;
21 import com.android.cts.verifier.R;
22 
23 public class LocationModeBatterySavingTestActivity extends LocationModeTestActivity {
24 
25     @Override
createTestItems()26     protected void createTestItems() {
27         createUserItem(R.string.location_mode_turn_on);
28         createUserItem(R.string.location_mode_select_battery_saving);
29         createAutoItem(R.string.location_mode_secure_gps_off);
30         createAutoItem(R.string.location_mode_secure_nlp_on);
31         createAutoItem(R.string.location_mode_manager_gps_off);
32         createAutoItem(R.string.location_mode_manager_nlp_on);
33     }
34 
35     @Override
setInfoResources()36     protected void setInfoResources() {
37         setInfoResources(R.string.location_mode_battery_saving_test,
38                 R.string.location_mode_battery_saving_info, -1);
39     }
40 
41     @Override
testAdvance(int state)42     protected void testAdvance(int state) {
43         switch (state) {
44             case 0:
45                 testIsOn(0);
46                 break;
47             case 1:
48                 testIsExpectedMode(1, Secure.LOCATION_MODE_BATTERY_SAVING);
49                 break;
50             case 2:
51                 testSecureProviderIsDisabled(2, LocationManager.GPS_PROVIDER);
52                 break;
53             case 3:
54                 testSecureProviderIsEnabled(3, LocationManager.NETWORK_PROVIDER);
55                 break;
56             case 4:
57                 testManagerProviderIsDisabled(4, LocationManager.GPS_PROVIDER);
58                 break;
59             case 5:
60                 testManagerProviderIsEnabled(5, LocationManager.NETWORK_PROVIDER);
61                 break;
62         }
63     }
64 }
65