1a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills/* 2a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * Copyright (C) 2016 The Android Open Source Project 3a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * 4a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * Licensed under the Apache License, Version 2.0 (the "License"); 5a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * you may not use this file except in compliance with the License. 6a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * You may obtain a copy of the License at 7a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * 8a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * http://www.apache.org/licenses/LICENSE-2.0 9a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * 10a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * Unless required by applicable law or agreed to in writing, software 11a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * distributed under the License is distributed on an "AS IS" BASIS, 12a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * See the License for the specific language governing permissions and 14a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills * limitations under the License. 15a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills */ 16eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 17eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpandepackage com.android.server.wifi; 18eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 19eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpandeimport java.util.HashMap; 20eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 21a8367288377cbaed6371256ca837b7aa22280706Mitchell Willspublic class MockResources extends android.test.mock.MockResources { 22eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 23eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande private HashMap<Integer, Boolean> mBooleanValues; 24eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande private HashMap<Integer, Integer> mIntegerValues; 25eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande private HashMap<Integer, String> mStringValues; 26eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 27a8367288377cbaed6371256ca837b7aa22280706Mitchell Wills public MockResources() { 28eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande mBooleanValues = new HashMap<Integer, Boolean>(); 29eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande mIntegerValues = new HashMap<Integer, Integer>(); 30eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande mStringValues = new HashMap<Integer, String>(); 31eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 32eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 33eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande @Override 34eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande public boolean getBoolean(int id) { 35eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande if (mBooleanValues.containsKey(id)) { 36eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande return mBooleanValues.get(id); 37eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } else { 38eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande return false; 39eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 40eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 41eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 42eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande @Override 43eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande public int getInteger(int id) { 44eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande if (mIntegerValues.containsKey(id)) { 45eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande return mIntegerValues.get(id); 46eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } else { 47eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande return 0; 48eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 49eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 50eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 51eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande @Override 52eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande public String getString(int id) { 53eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande if (mStringValues.containsKey(id)) { 54eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande return mStringValues.get(id); 55eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } else { 56eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande return null; 57eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 58eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 59eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 60eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande public void setBoolean(int id, boolean value) { 61eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande mBooleanValues.put(id, value); 62eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 63eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 64eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande public void setInteger(int id, int value) { 65eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande mIntegerValues.put(id, value); 66eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 67eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande 68eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande public void setString(int id, String value) { 69eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande mStringValues.put(id, value); 70eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande } 71eee1d479d8d402a2e78e2f143e957030cfc77749Vinit Deshpande} 72