DevTools: consistently use camel case for URL parameter names
[chromium-blink-merge.git] / base / sys_info_unittest.cc
blob57eb905daba759faa30cde26b52af0c6c2add072
1 // Copyright (c) 2011 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.
5 #include "base/file_util.h"
6 #include "base/sys_info.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/platform_test.h"
10 typedef PlatformTest SysInfoTest;
12 TEST_F(SysInfoTest, NumProcs) {
13 // We aren't actually testing that it's correct, just that it's sane.
14 EXPECT_GE(base::SysInfo::NumberOfProcessors(), 1);
17 TEST_F(SysInfoTest, AmountOfMem) {
18 // We aren't actually testing that it's correct, just that it's sane.
19 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemory(), 0);
20 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemoryMB(), 0);
23 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) {
24 // We aren't actually testing that it's correct, just that it's sane.
25 FilePath tmp_path;
26 ASSERT_TRUE(file_util::GetTempDir(&tmp_path));
27 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0)
28 << tmp_path.value();
31 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
32 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) {
33 int32 os_major_version = -1;
34 int32 os_minor_version = -1;
35 int32 os_bugfix_version = -1;
36 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
37 &os_minor_version,
38 &os_bugfix_version);
39 EXPECT_GT(os_major_version, -1);
40 EXPECT_GT(os_minor_version, -1);
41 EXPECT_GT(os_bugfix_version, -1);
43 #endif
45 #if defined(OS_CHROMEOS)
46 TEST_F(SysInfoTest, GoogleChromeOSVersionNumbers) {
47 int32 os_major_version = -1;
48 int32 os_minor_version = -1;
49 int32 os_bugfix_version = -1;
50 std::string lsb_release("FOO=1234123.34.5\n");
51 lsb_release.append(base::SysInfo::GetLinuxStandardBaseVersionKey());
52 lsb_release.append("=1.2.3.4\n");
53 base::SysInfo::ParseLsbRelease(lsb_release,
54 &os_major_version,
55 &os_minor_version,
56 &os_bugfix_version);
57 EXPECT_EQ(2, os_major_version);
58 EXPECT_EQ(3, os_minor_version);
59 EXPECT_EQ(4, os_bugfix_version);
62 TEST_F(SysInfoTest, GoogleChromeOSVersionNumbersFirst) {
63 int32 os_major_version = -1;
64 int32 os_minor_version = -1;
65 int32 os_bugfix_version = -1;
66 std::string lsb_release(base::SysInfo::GetLinuxStandardBaseVersionKey());
67 lsb_release.append("=1.2.3.4\n");
68 lsb_release.append("FOO=1234123.34.5\n");
69 base::SysInfo::ParseLsbRelease(lsb_release,
70 &os_major_version,
71 &os_minor_version,
72 &os_bugfix_version);
73 EXPECT_EQ(2, os_major_version);
74 EXPECT_EQ(3, os_minor_version);
75 EXPECT_EQ(4, os_bugfix_version);
78 TEST_F(SysInfoTest, GoogleChromeOSNoVersionNumbers) {
79 int32 os_major_version = -1;
80 int32 os_minor_version = -1;
81 int32 os_bugfix_version = -1;
82 std::string lsb_release("FOO=1234123.34.5\n");
83 base::SysInfo::ParseLsbRelease(lsb_release,
84 &os_major_version,
85 &os_minor_version,
86 &os_bugfix_version);
87 EXPECT_EQ(-1, os_major_version);
88 EXPECT_EQ(-1, os_minor_version);
89 EXPECT_EQ(-1, os_bugfix_version);
92 #endif // OS_CHROMEOS