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

Unified Diff: base/test/expectations/expectation.cc

Issue 12218098: [Test Expectations] Add GetCurrentPlatform() and GetCurrentConfiguration(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 10 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 | « base/test/expectations/expectation.h ('k') | base/test/expectations/expectation_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/expectations/expectation.cc
diff --git a/base/test/expectations/expectation.cc b/base/test/expectations/expectation.cc
index 5baf04f7c67f4d7c8656832ccbc9bee13d3d2340..31a387eba3e2354e80da7f8a6a7005296cc919a8 100644
--- a/base/test/expectations/expectation.cc
+++ b/base/test/expectations/expectation.cc
@@ -4,6 +4,16 @@
#include "base/test/expectations/expectation.h"
+#include "base/logging.h"
+
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#elif defined(OS_MACOSX) && !defined(OS_IOS)
+#include "base/mac/mac_util.h"
+#elif defined(OS_LINUX)
+#include "base/sys_info.h"
+#endif
+
namespace test_expectations {
bool ResultFromString(const base::StringPiece& result, Result* out_result) {
@@ -44,8 +54,8 @@ static bool IsValidPlatform(const Platform* platform) {
}
} else if (name == "Linux") {
if (variant != "" &&
- variant != "x32" &&
- variant != "x64") {
+ variant != "32" &&
+ variant != "64") {
return false;
}
} else if (name == "ChromeOS") {
@@ -75,6 +85,46 @@ bool PlatformFromString(const base::StringPiece& modifier,
return IsValidPlatform(out_platform);
}
+Platform GetCurrentPlatform() {
+ Platform platform;
+#if defined(OS_WIN)
+ platform.name = "Win";
+ base::win::Version version = base::win::GetVersion();
+ if (version == base::win::VERSION_XP)
+ platform.variant = "XP";
+ else if (version == base::win::VERSION_VISTA)
+ platform.variant = "Vista";
+ else if (version == base::win::VERSION_WIN7)
+ platform.variant = "7";
+ else if (version == base::win::VERSION_WIN8)
+ platform.variant = "8";
+#elif defined(OS_IOS)
+ platform.name = "iOS";
+#elif defined(OS_MACOSX)
+ platform.name = "Mac";
+ if (base::mac::IsOSSnowLeopard())
+ platform.variant = "10.6";
+ else if (base::mac::IsOSLion())
+ platform.variant = "10.7";
+ else if (base::mac::IsOSMountainLion())
+ platform.variant = "10.8";
+#elif defined(OS_CHROMEOS)
+ platform.name = "ChromeOS";
+#elif defined(OS_ANDROID)
+ platform.name = "Android";
+#elif defined(OS_LINUX)
+ platform.name = "Linux";
+ std::string arch = base::SysInfo::OperatingSystemArchitecture();
+ if (arch == "x86")
+ platform.variant = "32";
+ else if (arch == "x86_64")
+ platform.variant = "64";
+#else
+ NOTREACHED();
+#endif
+ return platform;
+}
+
bool ConfigurationFromString(const base::StringPiece& modifier,
Configuration* out_configuration) {
if (modifier == "Debug")
@@ -87,6 +137,16 @@ bool ConfigurationFromString(const base::StringPiece& modifier,
return true;
}
+Configuration GetCurrentConfiguration() {
+#if NDEBUG
+ return CONFIGURATION_RELEASE;
+#else
+ return CONFIGURATION_DEBUG;
+#endif
+ NOTREACHED();
+ return CONFIGURATION_UNSPECIFIED;
+}
+
Expectation::Expectation()
: configuration(CONFIGURATION_UNSPECIFIED),
result(RESULT_PASS) {
« no previous file with comments | « base/test/expectations/expectation.h ('k') | base/test/expectations/expectation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698