1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_TEST_CHROMEDRIVER_CHROME_BROWSER_INFO_H_
6#define CHROME_TEST_CHROMEDRIVER_CHROME_BROWSER_INFO_H_
7
8#include "chrome/test/chromedriver/chrome/status.h"
9
10// Content Shell and WebView have an empty product version and a fake user
11// agent. There's no way to detect the actual version, so unless specified we
12// assume it is tip of tree.
13static const int kToTBuildNo = 9999;
14
15// Similarly, if the Blink Revision isn't given then assume it is tip of tree.
16static const int kToTBlinkRevision = 999999;
17
18struct BrowserInfo {
19  BrowserInfo();
20  BrowserInfo(std::string browser_name_,
21              std::string browser_version_,
22              int build_no_,
23              int blink_revision_);
24
25  std::string browser_name;
26  std::string browser_version;
27  int build_no;
28  int blink_revision;
29};
30
31Status ParseBrowserInfo(const std::string& data,
32                        BrowserInfo* browser_info);
33
34Status ParseBrowserString(const std::string& browser_string,
35                          std::string* browser_name,
36                          std::string* browser_version,
37                          int* build_no);
38
39Status ParseBlinkVersionString(const std::string& blink_version,
40                               int* blink_revision);
41
42bool IsGitHash(const std::string& revision);
43
44#endif  // CHROME_TEST_CHROMEDRIVER_CHROME_BROWSER_INFO_H_
45