Skip to content

Add L1 tests for Bluetooth onPowerModeChanged power management behavior#52

Draft
Copilot wants to merge 3 commits into
developfrom
copilot/sub-pr-50-again
Draft

Add L1 tests for Bluetooth onPowerModeChanged power management behavior#52
Copilot wants to merge 3 commits into
developfrom
copilot/sub-pr-50-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 19, 2026

onPowerModeChanged() had no L1 test coverage for its HID-skip logic and autoConnectStatus-conditional disconnect, leaving critical power transition behavior unverified.

Changes

  • New BluetoothPowerModeTest fixture — pre-populates the paired device cache with a "HUMAN INTERFACE DEVICE" entry at init time by mocking GetValue to return the device JSON and BTRMGR_GetPairedDevices to return the matching handle (prevents cache scrubbing in updateCacheFromDevice()).

  • onPowerModeChanged test matrix (11 cases across both fixtures):

    Transition Device autoConnectStatus Expected
    ON → same no-op
    ON/UNKNOWN → STANDBY/LIGHT_SLEEP non-HID DISABLED BTRMGR_StopAudioStreamingOut called
    ON → STANDBY non-HID ENABLED / empty cache no disconnect
    ON → STANDBY HID DISABLED skipped (no disconnect)
    X → ON non-HID present any BTRMGR_SetAdapterPowerStatus(0, 1)
    X → ON HID only any no SetAdapterPowerStatus
    X → DEEP_SLEEP non-HID ENABLED always disconnects
    X → DEEP_SLEEP HID any skipped
    STANDBY → LIGHT_SLEEP unhandled, no-op
  • Non-HID devices are injected into the cache via the existing setAutoConnect JSON-RPC call (produces an entry with empty deviceType, which does not match "HUMAN INTERFACE DEVICE").


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pahearn73 <8170037+pahearn73@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on Bluetooth enhancements for power management Add L1 tests for Bluetooth onPowerModeChanged power management behavior Mar 19, 2026
Copilot AI requested a review from pahearn73 March 19, 2026 14:32
@pahearn73 pahearn73 force-pushed the feature/RDKEMW-13334 branch from 637d6e5 to bb4754b Compare March 20, 2026 14:41
@pahearn73 pahearn73 force-pushed the feature/RDKEMW-13334 branch from 2738503 to eae8555 Compare March 27, 2026 21:54
Base automatically changed from feature/RDKEMW-13334 to develop April 3, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants