refactor: reorganize client transport and extension internals
- Split client, native, remote, serve, markdown, and SDK internals into focused packages with direct imports. - Move local and remote transport framing/protocol helpers behind clearer module boundaries. - Break up the extension injected DOM logic into a separate content dispatch bundle and dedicated content modules. - Add explicit client handling for passive remote discovery without noisy PQ warnings. - Keep behavior covered with updated unit, integration, and extension tests.
This commit is contained in:
@@ -18,7 +18,7 @@ class TestEndpoints:
|
||||
|
||||
assert _normalize_endpoint("example.com:443") == "example.com"
|
||||
assert _normalize_endpoint("example.com:8765") == "example.com:8765"
|
||||
assert _normalize_endpoint("192.168.1.10:443") == "192.168.1.10:443"
|
||||
assert _normalize_endpoint("203.0.113.10:443") == "203.0.113.10:443"
|
||||
|
||||
def test_resolve_connect_endpoint_defaults_domain_to_443(self):
|
||||
from browser_cli.endpoints import _resolve_connect_endpoint
|
||||
@@ -69,7 +69,7 @@ class TestReExports:
|
||||
def test_client_still_exposes_moved_names(self):
|
||||
from browser_cli import client
|
||||
|
||||
# moved to endpoints / remote_transport / _errors but still reachable here
|
||||
# moved to endpoints / remote.transport / errors but still reachable here
|
||||
for name in (
|
||||
"BrowserNotConnected",
|
||||
"_normalize_endpoint",
|
||||
@@ -90,16 +90,16 @@ class TestReExports:
|
||||
|
||||
def test_patching_client_send_remote_still_intercepts(self):
|
||||
# send_command resolves _send_remote as a browser_cli.client global, so
|
||||
# patching there must still take effect after the move to remote_transport.
|
||||
with patch("browser_cli.client._send_remote", return_value=None) as fake:
|
||||
assert browser_cli.client._send_remote is fake
|
||||
# patching there must still take effect after the move to remote.transport.
|
||||
with patch("browser_cli.client.core._send_remote", return_value=None) as fake:
|
||||
assert browser_cli.client.core._send_remote is fake
|
||||
|
||||
# ── BrowserCLI mixin composition ─────────────────────────────────────────────
|
||||
|
||||
class TestMixinComposition:
|
||||
def test_factory_builds_bound_tab(self):
|
||||
b = BrowserCLI()
|
||||
tab = b._make_tab({"id": 7, "windowId": 1, "title": "t", "url": "u"})
|
||||
tab = b.tab_from({"id": 7, "windowId": 1, "title": "t", "url": "u"})
|
||||
assert tab.id == 7
|
||||
assert tab._browser is b
|
||||
|
||||
@@ -111,7 +111,7 @@ class TestMixinComposition:
|
||||
display_name = "host:work"
|
||||
remote = "host:8765"
|
||||
|
||||
tab = b._make_tab_for({"id": 1, "windowId": 0}, _Target())
|
||||
tab = b.tab_from_target({"id": 1, "windowId": 0}, _Target())
|
||||
assert tab.browser == "host:work"
|
||||
assert isinstance(tab._browser, BrowserCLI)
|
||||
assert tab._browser is not b
|
||||
|
||||
Reference in New Issue
Block a user