Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5465)

Unified Diff: chrome/test/chromedriver/chrome/browser_info.cc

Issue 667823003: [chromedriver] Accept short git hashes Blink revisions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/chromedriver/chrome/browser_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/browser_info.cc
diff --git a/chrome/test/chromedriver/chrome/browser_info.cc b/chrome/test/chromedriver/chrome/browser_info.cc
index e78c1eb279f955b1c90c940fe6ea07d10f45d6b0..d62e90db49c09f995222275bcfe666133bbb8f28 100644
--- a/chrome/test/chromedriver/chrome/browser_info.cc
+++ b/chrome/test/chromedriver/chrome/browser_info.cc
@@ -101,10 +101,10 @@ Status ParseBlinkVersionString(const std::string& blink_version,
"unrecognized Blink version string: " + blink_version);
}
- // Chrome OS reports its Blink revision as a (non-abbreviated) git hash. In
- // this case, ignore it and don't set |blink_revision|. For Chrome (and for
- // Chrome OS) we use the build number instead of the blink revision for
- // decisions about backwards compatibility.
+ // Chrome OS reports its Blink revision as a git hash. In this case, ignore it
+ // and don't set |blink_revision|. For Chrome (and for Chrome OS) we use the
+ // build number instead of the blink revision for decisions about backwards
+ // compatibility.
std::string revision = blink_version.substr(before + 1, after - before - 1);
if (!IsGitHash(revision) && !base::StringToInt(revision, blink_revision)) {
return Status(kUnknownError, "unrecognized Blink revision: " + revision);
@@ -114,7 +114,9 @@ Status ParseBlinkVersionString(const std::string& blink_version,
}
bool IsGitHash(const std::string& revision) {
- const int kGitHashLength = 40;
- return revision.size() == kGitHashLength
+ const int kShortGitHashLength = 7;
+ const int kFullGitHashLength = 40;
+ return kShortGitHashLength <= revision.size()
+ && revision.size() <= kFullGitHashLength
&& base::ContainsOnlyChars(revision, "0123456789abcdefABCDEF");
}
« no previous file with comments | « no previous file | chrome/test/chromedriver/chrome/browser_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698