mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
fix(runtime): preserve clients used for launcher sign-in
This commit is contained in:
1 parent
d7898360e3
commit
6f8a35d1f3
2 files changed
+35
-1
No files matched your search
@@ -979,7 +979,7 @@ def launched(argv):
|
||||
|
||||
|
||||
def shares_sign_in(argv):
|
||||
return "-sso" in (arg.lower() for arg in argv[1:])
|
||||
return any(arg.lower() in ("-sso", "-launcherlogin") for arg in argv[1:])
|
||||
|
||||
|
||||
def agent_up(processes):
|
||||
|
||||
@@ -689,6 +689,13 @@ class ProcessTest(Temp):
|
||||
self.assertFalse(BNET["shares_sign_in"](["D2R.exe", "-uid", "osi"]))
|
||||
self.assertFalse(BNET["shares_sign_in"](["-sso.exe"]))
|
||||
|
||||
def test_sign_in_flags_are_whole_arguments_after_the_program(self):
|
||||
for argv in (["Example.exe", "-launcherlogin"], ["Example.exe", "-LAUNCHERLOGIN"]):
|
||||
self.assertTrue(BNET["shares_sign_in"](argv))
|
||||
for argv in ([], ["-launcherlogin"], ["Example.exe", "--launcherlogin"],
|
||||
["Example.exe", "-launcherlogin=false"], ["Example.exe", "path/-launcherlogin"]):
|
||||
self.assertFalse(BNET["shares_sign_in"](argv))
|
||||
|
||||
def test_battle_net_takes_work_once_its_agent_is_up(self):
|
||||
client = (1, ["C:\\Program Files (x86)\\Battle.net\\Battle.net.exe"])
|
||||
agent = (2, ["C:\\ProgramData\\Battle.net\\Agent\\Agent.9824\\Agent.exe"])
|
||||
@@ -870,6 +877,24 @@ class TidyTest(unittest.TestCase):
|
||||
self.assertEqual(self.stopped, [])
|
||||
self.assertEqual(self.notified, [])
|
||||
|
||||
def test_launcher_sign_in_keeps_the_client_without_a_time_limit(self):
|
||||
for flag in ("-launcherlogin", "-LAUNCHERLOGIN"):
|
||||
with self.subTest(flag=flag):
|
||||
game = (6, ["C:\\Games\\Example.exe", flag, "-uid", "example"])
|
||||
tidy = BNET["Tidy"](settle=20, gone=30)
|
||||
up = [self.CLIENT, self.PAGE, self.AGENT, game]
|
||||
self.assertEqual(self.run_tidy(tidy, [(0, up), (20, up), (120, up), (3600, up)]),
|
||||
[False, False, False, False])
|
||||
self.assertEqual(self.stopped, [])
|
||||
self.assertEqual(self.notified, [])
|
||||
|
||||
def test_launcher_sign_in_still_reclaims_helpers_after_the_client_exits(self):
|
||||
game = (6, ["C:\\Games\\Example.exe", "-launcherlogin", "-uid", "example"])
|
||||
tidy = BNET["Tidy"](settle=20, gone=30)
|
||||
self.run_tidy(tidy, [(0, [self.CLIENT, self.AGENT, game]),
|
||||
(5, [self.AGENT, game]), (20, [self.AGENT, game])])
|
||||
self.assertEqual(self.stopped, [[3]])
|
||||
|
||||
def test_what_battle_net_left_beside_such_a_game_once_closed_itself_is_stopped(self):
|
||||
d4 = (6, ["C:\\Program Files (x86)\\Diablo IV\\Diablo IV.exe", "-sso", "-launch", "-uid", "fenris"])
|
||||
tidy = BNET["Tidy"](settle=20, gone=30)
|
||||
@@ -1181,6 +1206,15 @@ class LaunchTest(Harness):
|
||||
self.assertEqual(BNET["launch"](self.root, "Fen"), 0)
|
||||
self.assertEqual([c for c in self.calls if c[0] == "stop"], [("stop", [10, 11, 12, 13, 14, 30])])
|
||||
|
||||
def test_launcher_sign_in_keeps_the_client_until_the_game_exits(self):
|
||||
self.install()
|
||||
up = self.clients() + [(30, self.AGENT)]
|
||||
game = (40, ["C:\\Games\\Example.exe", "-launcherlogin", "-uid", "example"])
|
||||
self.states = [[], [], up, up + [game], up + [game], up + [game], up, up]
|
||||
with mock.patch.dict(BNET, {"GAME_SETTLE": 0}):
|
||||
self.assertEqual(BNET["launch"](self.root, "Example"), 0)
|
||||
self.assertEqual([c for c in self.calls if c[0] == "stop"], [("stop", [10, 11, 12, 13, 14, 30])])
|
||||
|
||||
def test_a_game_installed_in_battle_nets_folder_is_followed_not_stopped(self):
|
||||
self.install()
|
||||
up = self.clients() + [(30, self.AGENT)]
|
||||
|
||||
Reference in new issue
Block a user