Merge "First commit for settings panels"
This commit is contained in:
committed by
Android (Google) Code Review
commit
71a255968f
@@ -187,11 +187,4 @@ public class AirplaneModePreferenceControllerTest {
|
||||
new AirplaneModePreferenceController(mContext,"toggle_airplane");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AirplaneModePreferenceController controller =
|
||||
new AirplaneModePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.settings.panel;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.wifi.WifiSlice;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
|
||||
public class InternetConnectivityPanelTest {
|
||||
|
||||
private InternetConnectivityPanel mPanel;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mPanel = InternetConnectivityPanel.create(RuntimeEnvironment.application);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlices_containsNecessarySlices() {
|
||||
final List<Uri> uris = mPanel.getSlices();
|
||||
|
||||
assertThat(uris).containsExactly(WifiSlice.WIFI_URI,
|
||||
InternetConnectivityPanel.AIRPLANE_URI);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.settings.panel;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class PanelFeatureProviderImplTest {
|
||||
|
||||
private Context mContext;
|
||||
private PanelFeatureProviderImpl mProvider;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mProvider = new PanelFeatureProviderImpl();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPanel_internetConnectivityKey_returnsCorrectPanel() {
|
||||
final PanelContent panel = mProvider.getPanel(mContext,
|
||||
SettingsPanelActivity.PANEL_TYPE_WIFI);
|
||||
|
||||
assertThat(panel).isInstanceOf(InternetConnectivityPanel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import com.android.settings.overlay.DockUpdaterFeatureProvider;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.overlay.SupportFeatureProvider;
|
||||
import com.android.settings.overlay.SurveyFeatureProvider;
|
||||
import com.android.settings.panel.PanelFeatureProvider;
|
||||
import com.android.settings.search.SearchFeatureProvider;
|
||||
import com.android.settings.security.SecurityFeatureProvider;
|
||||
import com.android.settings.slices.SlicesFeatureProvider;
|
||||
@@ -61,6 +62,7 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
public final UserFeatureProvider userFeatureProvider;
|
||||
public final AssistGestureFeatureProvider assistGestureFeatureProvider;
|
||||
public final AccountFeatureProvider mAccountFeatureProvider;
|
||||
public final PanelFeatureProvider mPanelFeatureProvider;
|
||||
|
||||
public SlicesFeatureProvider slicesFeatureProvider;
|
||||
public SearchFeatureProvider searchFeatureProvider;
|
||||
@@ -102,6 +104,7 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
assistGestureFeatureProvider = mock(AssistGestureFeatureProvider.class);
|
||||
slicesFeatureProvider = mock(SlicesFeatureProvider.class);
|
||||
mAccountFeatureProvider = mock(AccountFeatureProvider.class);
|
||||
mPanelFeatureProvider = mock(PanelFeatureProvider.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,4 +186,9 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
public AccountFeatureProvider getAccountFeatureProvider() {
|
||||
return mAccountFeatureProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PanelFeatureProvider getPanelFeatureProvider() {
|
||||
return mPanelFeatureProvider;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user