mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-23 06:46:02 +00:00
merge main into feat/native-userland-no-proot
This commit is contained in:
commit
507ccc6655
36 files changed
+1295
-67
No files matched your search
@@ -398,6 +398,30 @@ class DroiddeckctlTest(FakeAdbTest):
|
||||
self.assertEqual(4, code)
|
||||
self.assertEqual("NO_FRAMES", out["error"]["code"])
|
||||
|
||||
def test_provider_call_falls_back_to_a_broadcast_without_content(self):
|
||||
calls = []
|
||||
answers = iter([b"", b'{"ok": true, "command": "state"}'])
|
||||
|
||||
def adb(_adb, _serial, *args, timeout=30):
|
||||
calls.append(args)
|
||||
if args[:2] == ("shell", "content"):
|
||||
return ctl.subprocess.CompletedProcess(args, 127, b"", b"/system/bin/sh: content: inaccessible or not found")
|
||||
if args[:2] == ("shell", "am"):
|
||||
return ctl.subprocess.CompletedProcess(args, 0, b"Broadcast completed: result=0", b"")
|
||||
if args[:2] == ("shell", "pidof " + ctl.PACKAGE):
|
||||
return ctl.subprocess.CompletedProcess(args, 0, b"4940\n", b"")
|
||||
return ctl.subprocess.CompletedProcess(args, 0, next(answers), b"")
|
||||
|
||||
with unittest.mock.patch.object(ctl, "run_adb", adb), unittest.mock.patch.object(ctl.time, "sleep"):
|
||||
answer = ctl.provider_call("adb", "fake-1", "state", arg="a b", request={"x": 1})
|
||||
self.assertEqual({"ok": True, "command": "state"}, answer)
|
||||
broadcast = next(c for c in calls if c[:2] == ("shell", "am"))
|
||||
self.assertEqual(("shell", "am", "broadcast", "-a", ctl.PACKAGE + ".AGENT_CALL", "-p", ctl.PACKAGE), broadcast[:7])
|
||||
self.assertIn("'a b'", broadcast)
|
||||
self.assertEqual(ctl.encode_request({"x": 1}), broadcast[broadcast.index("request") + 1])
|
||||
call_id = broadcast[broadcast.index("id") + 1]
|
||||
self.assertIn("agent-calls/%s.json" % call_id, calls[-1][1])
|
||||
|
||||
def test_pacing_turns_timestats_off_when_the_dump_fails(self):
|
||||
calls = []
|
||||
|
||||
|
||||
Reference in new issue
Block a user