Remove obsolete bluetooth pages
1. Remove BluetoothSettingsObsolete 2. Remove DeviceListPreferenceObsoleteFragment 3. Update master swtich, now constantly point to new page 4. Update the tests Future cl will remove the page switch API in BluetoothFeatureProvider Bug: 63444548 Test: Test still pass Change-Id: I24fb5cd03cf30044edb7201426e11e0a818f0a7f
This commit is contained in:
@@ -127,23 +127,4 @@ public class BluetoothMasterSwitchPreferenceControllerTest {
|
||||
|
||||
verify(mPreference).setSummary("test summary");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePreferenceTreeClick_pairPageEnabled_showNewPage() {
|
||||
when(mFeatureFactory.bluetoothFeatureProvider.isPairingPageEnabled()).thenReturn(true);
|
||||
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
|
||||
verify(mActivity).startPreferencePanelAsUser(eq(mFragment),
|
||||
eq(BluetoothSettings.class.getName()), any(), eq(R.string.bluetooth), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePreferenceTreeClick_pairPageDisabled_showOldPage() {
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
|
||||
verify(mActivity).startPreferencePanelAsUser(eq(mFragment),
|
||||
eq(BluetoothSettingsObsolete.class.getName()), any(), eq(R.string.bluetooth), any(),
|
||||
any());
|
||||
}
|
||||
}
|
||||
|
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* 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.settings.bluetooth;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class BluetoothSettingsObsoleteTest {
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
private BluetoothSettingsObsolete mFragment;
|
||||
private FakeFeatureFactory mFeatureFactory;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
FakeFeatureFactory.setupForTest(mContext);
|
||||
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||
|
||||
mFragment = spy(new BluetoothSettingsObsolete());
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchIndexProvider_pairPageEnabled_keyAdded() {
|
||||
doReturn(true).when(mFeatureFactory.bluetoothFeatureProvider).isPairingPageEnabled();
|
||||
|
||||
final List<String> keys = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
|
||||
mContext);
|
||||
|
||||
assertThat(keys).contains(BluetoothSettingsObsolete.DATA_KEY_REFERENCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchIndexProvider_pairPageDisabled_keyNotAdded() {
|
||||
final List<String> keys = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
|
||||
mContext);
|
||||
|
||||
assertThat(keys).doesNotContain(BluetoothSettingsObsolete.DATA_KEY_REFERENCE);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user