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

Unified Diff: base/version.h

Issue 1364002: Fixed bug where an empty version string is considered valid. (Closed)
Patch Set: addressed comments Created 10 years, 9 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 | base/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/version.h
diff --git a/base/version.h b/base/version.h
index b2ad7f596aee9b1b2b29dad92d41486d747273b0..6b0680a32d54b0e266379dc1d962e28a9318ce45 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_
« no previous file with comments | « no previous file | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698