summaryrefslogtreecommitdiffstats
path: root/base/version.h
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 22:19:04 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 22:19:04 +0000
commit26931bcf7aae254adf95cd5e8a104127a1cf7af8 (patch)
tree61287245d95f5889c54a304b5822b6c5d977c2c7 /base/version.h
parentceb47118d6c222d6b90f52dcbf9a77d38faf65eb (diff)
downloadchromium_src-26931bcf7aae254adf95cd5e8a104127a1cf7af8.zip
chromium_src-26931bcf7aae254adf95cd5e8a104127a1cf7af8.tar.gz
chromium_src-26931bcf7aae254adf95cd5e8a104127a1cf7af8.tar.bz2
Fixed bug where an empty version string is considered valid.
Made default constructor public, but DCHECK() on any use of a default-constructed object. BUG=none TEST=unittests Review URL: http://codereview.chromium.org/1364002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/version.h')
-rw-r--r--base/version.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/base/version.h b/base/version.h
index b2ad7f5..6b0680a 100644
--- a/base/version.h
+++ b/base/version.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "testing/gtest/include/gtest/gtest_prod.h"
class Version {
public:
@@ -18,6 +19,11 @@ class Version {
static Version* GetVersionFromString(const std::wstring& version_str);
static Version* GetVersionFromString(const std::string& version_str);
+ // Exposed only so that a Version can be stored in STL containers;
+ // any call to the methods below on a default-constructed Version
+ // will DCHECK.
+ Version();
+
~Version() {}
bool Equals(const Version& other) const;
@@ -31,10 +37,14 @@ class Version {
const std::vector<uint16>& components() const { return components_; }
private:
- Version() {}
bool InitFromString(const std::string& version_str);
+ bool is_valid_;
std::vector<uint16> components_;
+
+ FRIEND_TEST(VersionTest, DefaultConstructor);
+ FRIEND_TEST(VersionTest, GetVersionFromString);
+ FRIEND_TEST(VersionTest, Compare);
};
#endif // BASE_VERSION_H_