• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 package com.android.settings.bluetooth
17 
18 import android.bluetooth.BluetoothDevice
19 import com.android.settings.R
20 import com.android.settings.testutils.FakeFeatureFactory
21 import com.android.settingslib.widget.LayoutPreference
22 import com.google.common.truth.Truth.assertThat
23 import org.junit.Rule
24 import org.junit.Test
25 import org.mockito.Mock
26 import org.mockito.junit.MockitoJUnit
27 import org.mockito.junit.MockitoRule
28 import org.mockito.kotlin.whenever
29 
30 class BluetoothDetailsBannerControllerTest : BluetoothDetailsControllerTestBase() {
31     @get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule()
32 
33     private lateinit var controller: BluetoothDetailsBannerController
34     private lateinit var preference: LayoutPreference
35 
setUpnull36     override fun setUp() {
37         super.setUp()
38         FakeFeatureFactory.setupForTest()
39         controller =
40             BluetoothDetailsBannerController(mContext, mFragment, mCachedDevice, mLifecycle)
41         preference = LayoutPreference(mContext, R.layout.bluetooth_details_banner)
42         preference.key = controller.getPreferenceKey()
43         mScreen.addPreference(preference)
44     }
45 
46     @Test
iaAvailable_notKeyMissing_falsenull47     fun iaAvailable_notKeyMissing_false() {
48         setupDevice(makeDefaultDeviceConfig())
49 
50         assertThat(controller.isAvailable).isFalse()
51     }
52 
53     // TODO(b/379729762): add more tests after BluetoothDevice.getKeyMissingCount is available.
54 }
55