Lines Matching full:adb
17 """Tests for the adb program itself.
46 """Creates a fake ADB daemon that just replies with a CNXN packet."""
111 """Context manager for an ADB connection.
116 output = subprocess.check_output(["adb", "connect", serial])
124 subprocess.Popen(["adb", "disconnect", serial],
131 """Context manager for an ADB server.
133 This creates an ADB server and returns the port it's listening on.
148 proc = subprocess.Popen(["adb", "-L", "tcp:localhost:{}".format(port),
162 """Tests for the ADB commandline."""
167 ["adb", "help"], stderr=subprocess.STDOUT)
171 """Get a version number out of the output of adb."""
172 lines = subprocess.check_output(["adb", "version"]).splitlines()
177 # Newer versions of ADB have a second line of output for the
184 """Make sure 'adb tcpip' parsing is sane."""
185 proc = subprocess.Popen(["adb", "tcpip"],
192 proc = subprocess.Popen(["adb", "tcpip", "foo"],
201 """Tests for the ADB server."""
212 launch_server() should not let the adb server inherit
213 stdin/stdout/stderr handles, which can cause callers of adb.exe to hang.
217 # This test takes 5 seconds to run on Windows: if there is no adb server
218 # running on the the port used below, adb kill-server tries to make a
220 # adb start-server does the same TCP connection which takes another
223 # Start adb client with redirected stdin/stdout/stderr to check if it
224 # passes those redirections to the adb server that it starts. To do
225 # this, run an instance of the adb server on a non-default port so we
226 # don't conflict with a pre-existing adb server that may already be
227 # setup with adb TCP/emulator connections. If there is a pre-existing
228 # adb server, this also tests whether multiple instances of the adb
229 # server conflict on adb.log.
238 # Run the adb client and have it start the adb server.
239 proc = subprocess.Popen(["adb", "-P", str(port), "start-server"],
257 # Wait for the adb client to finish. Once that has occurred, if
258 # stdin/stderr/stdout are still open, it must be open in the adb
264 # stdin must still be open in the adb server. The adb client is
265 # probably letting the adb server inherit stdin which would be
273 # stdout/stderr were not closed and and they must be open in the adb
274 # server, suggesting that the adb client is letting the adb server
276 self.assertTrue(stdout_event.wait(5), "adb stdout not closed")
277 self.assertTrue(stderr_event.wait(5), "adb stderr not closed")
282 subprocess.check_output(["adb", "-P", str(port), "kill-server"],
287 "adb doesn't yet support IPv6 on Windows",
297 ["adb", "-L", "tcp:[::1]:{}".format(server_port), "server"],
306 ["adb", "-P", str(server_port), "kill-server"],
331 """Ensure that adb emu kill works.
344 # Now that listening has started, start adb emu kill, telling it to
347 ["adb", "-s", "emulator-" + str(port), "emu", "kill"],
353 # then adb probably isn't reading the data that we sent it.
368 # Use SO_LINGER to send TCP RST segment to test whether adb
376 # Wait for adb to finish, so we can check return code.
379 # If this fails, adb probably isn't ignoring WSAECONNRESET when
380 # reading the response from the adb emu kill command (on Windows).
393 subprocess.check_output(["adb", "-P", str(server_port),
402 # Let the ADB server know that the emulator has started.
410 subprocess.check_call(["adb", "-P", str(server_port),
412 output = subprocess.check_output(["adb", "-P", str(server_port),
418 """Tests for adb connect."""
421 """Ensure that `adb connect localhost:1234` will try both IPv4 and IPv6.
442 output = subprocess.check_output(["adb", "connect", serial])
454 # Wait a bit to give adb some time to connect.
457 output = subprocess.check_output(["adb", "-s", serial,
462 proc = subprocess.Popen(["adb", "-s", serial, "shell", "true"],
468 subprocess.check_call(["adb", "-s", serial, "wait-for-device"])
470 output = subprocess.check_output(["adb", "-s", serial,
476 output = subprocess.check_output(["adb", "disconnect", serial])
481 subprocess.check_output(["adb", "-s", serial, "get-state"],
491 """Tests for adb disconnect."""
494 """Ensure that `adb disconnect` takes effect immediately."""
497 output = subprocess.check_output(["adb", "-P", str(port), "devices"])
503 output = subprocess.check_output(["adb", "-P", str(server_port),
521 output = subprocess.check_output(["adb", "-P", str(server_port),
535 usb_serial = subprocess.check_output(["adb", "-d", "get-serialno"]).strip()
542 serial = subprocess.check_output(["adb", "get-serialno"]).strip()
547 # Test only works with USB devices because adb _power_notification_thread does not kick
552 # Run an adb shell command in the background that takes a while to complete.
553 proc = subprocess.Popen(['adb', 'shell', 'sleep', '5'])
555 # Wait for startup of adb server's _power_notification_thread.
572 # Wait for connection to adb shell to be broken by _power_notification_thread detecting the
578 # If the power event was detected, the adb shell command should be broken very quickly.
581 """Use 'adb mdns check' to see if mdns discovery is available."""
584 output = subprocess.check_output(["adb", "-P", str(server_port),
639 """Tests for adb mdns."""
642 output = subprocess.check_output(["adb", "-P", str(port), "mdns", "services"])
647 output = subprocess.check_output(["adb", "-P", str(port), "devices"])
654 """Context manager for an ADB connection.
659 … output = subprocess.check_output(["adb", "-P", str(server_port), "connect", mdns_instance])
670 subprocess.Popen(["adb", "disconnect", serial],
677 """Ensure that `adb mdns services` correctly adds and removes a service
682 output = subprocess.check_output(["adb", "-P", str(server_port),
686 """TODO(joshuaduong): Add ipv6 tests once we have it working in adb"""
699 """Give adb some time to register the service"""
704 """Give adb some time to unregister the service"""
711 """Ensure that `adb mdns services` correctly adds and removes multiple services
716 output = subprocess.check_output(["adb", "-P", str(server_port),
720 """TODO(joshuaduong): Add ipv6 tests once we have it working in adb"""
741 """Give adb some time to register the service"""
747 """Give adb some time to unregister the service"""
755 """Ensure that `adb connect` by mdns instance name works (for non-pairing services)
765 should_connect = self.service_name != "adb-tls-pairing"
773 """Give adb some time to register the service"""
784 """Give adb some time to unregister the service"""
792 service_name = "adb"
797 service_name = "adb-tls-connect"
802 service_name = "adb-tls-pairing"