Commit 10b7c333 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[chromedriver] Change the search order of Chrome binary on Linux

Ideally, we should respect users' PATH when searching for Chrome binary.
For now, change the order of search paths to a better approximation of
the most common defaults across Linux distros.

In particular, try Chrome's default installation location AT LAST, so
that symlinks created by tools like update-alternatives are tried first,
which means honoring users' preferences of Chrome channels.

Change-Id: Ic77e439d3a3b428194af45b38bb85cfbb8a97508
Reviewed-on: https://chromium-review.googlesource.com/965444Reviewed-by: default avatarJonathon Kereliuk <kereliuk@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543696}
parent 48f80206
...@@ -47,13 +47,16 @@ void GetApplicationDirs(std::vector<base::FilePath>* locations) { ...@@ -47,13 +47,16 @@ void GetApplicationDirs(std::vector<base::FilePath>* locations) {
} }
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
void GetApplicationDirs(std::vector<base::FilePath>* locations) { void GetApplicationDirs(std::vector<base::FilePath>* locations) {
locations->push_back(base::FilePath("/opt/google/chrome")); // TODO: Respect users' PATH variables.
locations->push_back(base::FilePath("/usr/local/bin")); // Until then, we use an approximation of the most common defaults.
locations->push_back(base::FilePath("/usr/local/sbin")); locations->push_back(base::FilePath("/usr/local/sbin"));
locations->push_back(base::FilePath("/usr/bin")); locations->push_back(base::FilePath("/usr/local/bin"));
locations->push_back(base::FilePath("/usr/sbin")); locations->push_back(base::FilePath("/usr/sbin"));
locations->push_back(base::FilePath("/bin")); locations->push_back(base::FilePath("/usr/bin"));
locations->push_back(base::FilePath("/sbin")); locations->push_back(base::FilePath("/sbin"));
locations->push_back(base::FilePath("/bin"));
// Lastly, try the default installation location.
locations->push_back(base::FilePath("/opt/google/chrome"));
} }
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
void GetApplicationDirs(std::vector<base::FilePath>* locations) { void GetApplicationDirs(std::vector<base::FilePath>* locations) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment