mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-21 06:29:24 +08:00
* feat(mobile): add Remote Android probe, API, stream, and dashboard Multi-backend mobile support for self-hosted Octop: install-time host capability probe, gated /api/mobile routes, adb WebSocket stream, and Control → Remote Android dashboard page for Mac/emulator dev paths. * feat(mobile): wire harness agent adb tools for Remote Android Register mobile_screenshot, mobile_tap, mobile_swipe, mobile_launch_app, mobile_ui_dump, and mobile_handoff_to_user when capabilities.mobile is enabled, with permission and readiness checks. * feat(mobile): polish Remote Phone UX and session-bound agent control Rename the surface to Remote Phone, add quality presets, device info, AI panel, and chat-dock phone tab; bind agent tools to the active stream session and cover with unit tests. * chore(mobile): drop docs/specs/remote-android.md from the PR * fix(mobile): ruff I001 import formatting in device_info tests * fix(mobile): resolve adb via PATH and SDK env only Drop hardcoded per-OS SDK layout guesses; honor PATH, ANDROID_HOME, and ANDROID_SDK_ROOT (with adb.exe on Windows). * style(mobile): apply ruff format to mobile modules CI runs ruff format --check; keep these files format-clean. --------- Co-authored-by: jubaoliang <jubaoliang@gmail.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Unit tests for mobile agent-control binding."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from octop.infra.mobile.agent_control import (
|
|
clear_mobile_agent_control_if_device,
|
|
get_mobile_agent_control,
|
|
set_mobile_agent_control,
|
|
)
|
|
|
|
|
|
def setup_function() -> None:
|
|
set_mobile_agent_control(enabled=False, device=None)
|
|
|
|
|
|
def test_enable_requires_device() -> None:
|
|
try:
|
|
set_mobile_agent_control(enabled=True, device=None)
|
|
raise AssertionError("expected ValueError")
|
|
except ValueError:
|
|
pass
|
|
assert get_mobile_agent_control().enabled is False
|
|
|
|
|
|
def test_enable_and_disable() -> None:
|
|
st = set_mobile_agent_control(enabled=True, device="3b678f5c")
|
|
assert st.enabled is True
|
|
assert st.device == "3b678f5c"
|
|
st = set_mobile_agent_control(enabled=False, device="3b678f5c")
|
|
assert st.enabled is False
|
|
assert st.device is None
|
|
|
|
|
|
def test_clear_when_bound_device_leaves() -> None:
|
|
set_mobile_agent_control(enabled=True, device="phone")
|
|
clear_mobile_agent_control_if_device("emulator-5554")
|
|
assert get_mobile_agent_control().enabled is True
|
|
clear_mobile_agent_control_if_device("phone")
|
|
assert get_mobile_agent_control().enabled is False
|
|
assert get_mobile_agent_control().device is None
|