diff options
author | Live Channels Team <no-reply@google.com> | 2018-01-17 13:56:41 -0800 |
---|---|---|
committer | Nick Chalko <nchalko@google.com> | 2018-01-18 01:51:43 +0000 |
commit | 944779887775bd950cf1abf348d2df461593f6ab (patch) | |
tree | f3c8bd17c7874f5cccb44d39f7b11b99376dfd03 /tests/common/src/com/android/tv/testing/FakeRemoteConfig.java | |
parent | 38fef3bf253578f518d1bc727da4afb263194398 (diff) | |
download | TV-944779887775bd950cf1abf348d2df461593f6ab.tar.gz |
Sync aosp code with internal version.
Project import generated by Copybara.
PiperOrigin-RevId: 182265045
Change-Id: I32cd1a70947fd245f8f70c19eb1713943c7af0bc
Diffstat (limited to 'tests/common/src/com/android/tv/testing/FakeRemoteConfig.java')
-rw-r--r-- | tests/common/src/com/android/tv/testing/FakeRemoteConfig.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/common/src/com/android/tv/testing/FakeRemoteConfig.java b/tests/common/src/com/android/tv/testing/FakeRemoteConfig.java new file mode 100644 index 00000000..d8951d08 --- /dev/null +++ b/tests/common/src/com/android/tv/testing/FakeRemoteConfig.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.tv.testing; + +import android.text.TextUtils; +import com.android.tv.common.config.api.RemoteConfig; +import java.util.HashMap; +import java.util.Map; + +/** Fake {@link RemoteConfig} suitable for testing. */ +public class FakeRemoteConfig implements RemoteConfig { + public final Map<String, String> values = new HashMap(); + + @Override + public void fetch(OnRemoteConfigUpdatedListener listener) {} + + @Override + public String getString(String key) { + return values.get(key); + } + + @Override + public boolean getBoolean(String key) { + String value = values.get(key); + return TextUtils.isEmpty(value) ? false : Boolean.valueOf(key); + } + + @Override + public long getLong(String key) { + String value = values.get(key); + return TextUtils.isEmpty(value) ? 0 : Long.valueOf(key); + } +} |