mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-10-02 08:34:34 -04:00
docs: publish channels: main api
This commit is contained in:
1 parent
38d46c8e31
commit
ea25f8fc2c
6 files changed
+6
-6
No files matched your search
@@ -95,7 +95,7 @@
|
||||
<h1 class="cover"><span>Robolectric</span><wbr><span>Ble</span><wbr><span><span>Bonding</span></span></h1>
|
||||
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
|
||||
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":core:testing/androidMain" data-filterable-set=":core:testing/androidMain" data-active="" data-toggle=":core:testing/androidMain">android</button></div>
|
||||
<div class="content sourceset-dependent-content" data-active="" data-togglable=":core:testing/androidMain"><div class="symbol monospace"><span class="token keyword">object </span><a href="index.html">RobolectricBleBonding</a><span class="source-link-wrapper"><span class="source-link" data-element-type="source-link">(<a href="https://github.com/meshtastic/Meshtastic-Android/blob/main/core/testing/src/androidMain/kotlin/org/meshtastic/core/testing/RobolectricBleBonding.kt#L44">source</a>)</span></span></div><p class="paragraph">Reusable Robolectric helpers for driving Android Bluetooth bonding logic in <code class="lang-kotlin">androidHostTest</code> source sets.</p><p class="paragraph">These let a unit test exercise the real <code class="lang-kotlin">AndroidBluetoothRepository.bond()</code> (and any future BLE bonding code) without an emulator and without a production seam. They rely on two Robolectric behaviors (verified against Robolectric 4.16.x):</p><ul><li><p class="paragraph"><a href="https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothAdapter.html#getRemoteDevice(kotlin.ByteArray)">android.bluetooth.BluetoothAdapter.getRemoteDevice</a> caches the returned <a href="https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothDevice.html">BluetoothDevice</a> by address in a static map, so the shadow configured here is the <i>same</i> instance production code reads when it calls <code class="lang-kotlin">getRemoteDevice(mac)</code> internally.</p></li><li><p class="paragraph"><span data-unresolved-link="org.robolectric.shadows/ShadowBluetoothDevice/createBond/#/PointingToDeclaration/">ShadowBluetoothDevice.createBond</span> calls <code class="lang-kotlin">checkForBluetoothConnectPermission()</code> first, so tests must call <a href="grant-bluetooth-connect-permission.html">grantBluetoothConnectPermission</a> or <code class="lang-kotlin">createBond()</code> throws <a href="https://developer.android.com/reference/kotlin/java/lang/SecurityException.html">SecurityException</a> instead of returning a value.</p></li></ul><p class="paragraph">Isolation note: because the device cache is static and survives across tests in the same JVM, give each test a distinct MAC so bond-state cannot bleed between tests.</p></div> </div>
|
||||
<div class="content sourceset-dependent-content" data-active="" data-togglable=":core:testing/androidMain"><div class="symbol monospace"><span class="token keyword">object </span><a href="index.html">RobolectricBleBonding</a><span class="source-link-wrapper"><span class="source-link" data-element-type="source-link">(<a href="https://github.com/meshtastic/Meshtastic-Android/blob/main/core/testing/src/androidMain/kotlin/org/meshtastic/core/testing/RobolectricBleBonding.kt#L44">source</a>)</span></span></div><p class="paragraph">Reusable Robolectric helpers for driving Android Bluetooth bonding logic in <code class="lang-kotlin">androidHostTest</code> source sets.</p><p class="paragraph">These let a unit test exercise the real <code class="lang-kotlin">AndroidBluetoothRepository.bond()</code> (and any future BLE bonding code) without an emulator and without a production seam. They rely on two Robolectric behaviors (verified against Robolectric 4.16.x):</p><ul><li><p class="paragraph"><a href="https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothAdapter.html#getremotedevice">android.bluetooth.BluetoothAdapter.getRemoteDevice</a> caches the returned <a href="https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothDevice.html">BluetoothDevice</a> by address in a static map, so the shadow configured here is the <i>same</i> instance production code reads when it calls <code class="lang-kotlin">getRemoteDevice(mac)</code> internally.</p></li><li><p class="paragraph"><span data-unresolved-link="org.robolectric.shadows/ShadowBluetoothDevice/createBond/#/PointingToDeclaration/">ShadowBluetoothDevice.createBond</span> calls <code class="lang-kotlin">checkForBluetoothConnectPermission()</code> first, so tests must call <a href="grant-bluetooth-connect-permission.html">grantBluetoothConnectPermission</a> or <code class="lang-kotlin">createBond()</code> throws <a href="https://developer.android.com/reference/kotlin/java/lang/SecurityException.html">SecurityException</a> instead of returning a value.</p></li></ul><p class="paragraph">Isolation note: because the device cache is static and survives across tests in the same JVM, give each test a distinct MAC so bond-state cannot bleed between tests.</p></div> </div>
|
||||
</div>
|
||||
<div class="tabbedcontent">
|
||||
<div class="tabs-section" tabs-section="tabs-section"><button class="section-tab" data-active="" data-togglable="CONSTRUCTOR,TYPE,PROPERTY,FUNCTION">Members</button></div>
|
||||
|
||||
Reference in new issue
Block a user