[Cast Shell] Write DevTools port file to DIR_CAST_HOME.
When you send --remote-debugging-port=0 to Chrome, devtools chooses its own port and writes it to chrome::DIR_USER_DATA as a file named "DevToolsActivePort". Cast doesn't have a user data dir, so this CL writes the file to chromecast::DIR_CAST_HOME. The ability to specify a 0 as the port is needed to avoid the race condition of some other process binding to a port that you choose before Chrome gets a chance to bind to it. ChromeDriver switched to using DevToolsActivePort to fix a race condition: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2161 ChromeDriver does not natively work with cast_shell, but you can pass a shell script as the chrome binary to ChromeDriver and then have the shell script write a symbolic link from DevToolsActivePort in the user-data-dir flag value that ChromeDriver provides to the DIR_CAST_HOME directory. Therefore, this change allows cast_shell to work with ChromeDriver again. Note that the "Devtools started: port=X" log is not needed since DevTools code logs something like "DevTools listening on ws://0.0.0.0:45447/devtools/browser/665edec7-dbee-4547-816e-1d5e0c4a5dd3" already. Bug: 854864, chromedriver:2161 Change-Id: I55c20881607d581f628840cdf906569807f541ca Reviewed-on: https://chromium-review.googlesource.com/1114378 Commit-Queue: Caleb Rouleau <crouleau@chromium.org> Reviewed-by:Stephen Lanham <slan@chromium.org> Reviewed-by:
John Chen <johnchen@chromium.org> Reviewed-by:
Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#570526}
Showing
Please register or sign in to comment