• Caleb Rouleau's avatar
    [ChromeDriver] More robust adb server socket protocol implementation · 649794a9
    Caleb Rouleau authored
    This implementation separates the reading of the socket from the
    parsing of the data from the socket to avoid edge cases.
    
    The existing implementation makes assumptions about how the result
    will be pushed to the socket from the other end. It had different
    behavior depending on whether we read in an output like
    "OKAYOKAY0005abcde"
    in separate chucks like
    "OKAY"
    "OKAY"
    "0005abcde"
    versus as larger chunks like
    "OKAYOKAY"
    "0005abcde"
    or one big chunk like
    "OKAYOKAY0005abcde"
    
    Given that the adb server has some interesting edge cases (documented
    in this new code), it was more complex to handle them with the old
    implementation.
    
    Note also that these edge cases were being hit when I tried to pass
    port=0 to the adb server (so that it would allocate a remote forwarding
    port itself so there would be no race condition). So that work is
    blocked on this work.
    
    Bug: chromedriver:2161
    Change-Id: Ia83f8c3e4e0261a9467ab2814502c37f3f7e0645
    Reviewed-on: https://chromium-review.googlesource.com/1011131
    Commit-Queue: Caleb Rouleau <crouleau@chromium.org>
    Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#554886}
    649794a9
adb_client_socket.cc 22.7 KB