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

Side by Side Diff: base/sys_info_unittest.cc

Issue 8068028: Remove version hacks for platform version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix + Nit fix. Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/sys_info_chromeos.cc ('k') | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/sys_info.h" 6 #include "base/sys_info.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/platform_test.h" 8 #include "testing/platform_test.h"
9 9
10 typedef PlatformTest SysInfoTest; 10 typedef PlatformTest SysInfoTest;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 int32 os_major_version = -1; 47 int32 os_major_version = -1;
48 int32 os_minor_version = -1; 48 int32 os_minor_version = -1;
49 int32 os_bugfix_version = -1; 49 int32 os_bugfix_version = -1;
50 std::string lsb_release("FOO=1234123.34.5\n"); 50 std::string lsb_release("FOO=1234123.34.5\n");
51 lsb_release.append(base::SysInfo::GetLinuxStandardBaseVersionKey()); 51 lsb_release.append(base::SysInfo::GetLinuxStandardBaseVersionKey());
52 lsb_release.append("=1.2.3.4\n"); 52 lsb_release.append("=1.2.3.4\n");
53 base::SysInfo::ParseLsbRelease(lsb_release, 53 base::SysInfo::ParseLsbRelease(lsb_release,
54 &os_major_version, 54 &os_major_version,
55 &os_minor_version, 55 &os_minor_version,
56 &os_bugfix_version); 56 &os_bugfix_version);
57 EXPECT_EQ(2, os_major_version); 57 EXPECT_EQ(1, os_major_version);
58 EXPECT_EQ(3, os_minor_version); 58 EXPECT_EQ(2, os_minor_version);
59 EXPECT_EQ(4, os_bugfix_version); 59 EXPECT_EQ(3, os_bugfix_version);
60 } 60 }
61 61
62 TEST_F(SysInfoTest, GoogleChromeOSVersionNumbersFirst) { 62 TEST_F(SysInfoTest, GoogleChromeOSVersionNumbersFirst) {
63 int32 os_major_version = -1; 63 int32 os_major_version = -1;
64 int32 os_minor_version = -1; 64 int32 os_minor_version = -1;
65 int32 os_bugfix_version = -1; 65 int32 os_bugfix_version = -1;
66 std::string lsb_release(base::SysInfo::GetLinuxStandardBaseVersionKey()); 66 std::string lsb_release(base::SysInfo::GetLinuxStandardBaseVersionKey());
67 lsb_release.append("=1.2.3.4\n"); 67 lsb_release.append("=1.2.3.4\n");
68 lsb_release.append("FOO=1234123.34.5\n"); 68 lsb_release.append("FOO=1234123.34.5\n");
69 base::SysInfo::ParseLsbRelease(lsb_release, 69 base::SysInfo::ParseLsbRelease(lsb_release,
70 &os_major_version, 70 &os_major_version,
71 &os_minor_version, 71 &os_minor_version,
72 &os_bugfix_version); 72 &os_bugfix_version);
73 EXPECT_EQ(2, os_major_version); 73 EXPECT_EQ(1, os_major_version);
74 EXPECT_EQ(3, os_minor_version); 74 EXPECT_EQ(2, os_minor_version);
75 EXPECT_EQ(4, os_bugfix_version); 75 EXPECT_EQ(3, os_bugfix_version);
76 } 76 }
77 77
78 TEST_F(SysInfoTest, GoogleChromeOSNoVersionNumbers) { 78 TEST_F(SysInfoTest, GoogleChromeOSNoVersionNumbers) {
79 int32 os_major_version = -1; 79 int32 os_major_version = -1;
80 int32 os_minor_version = -1; 80 int32 os_minor_version = -1;
81 int32 os_bugfix_version = -1; 81 int32 os_bugfix_version = -1;
82 std::string lsb_release("FOO=1234123.34.5\n"); 82 std::string lsb_release("FOO=1234123.34.5\n");
83 base::SysInfo::ParseLsbRelease(lsb_release, 83 base::SysInfo::ParseLsbRelease(lsb_release,
84 &os_major_version, 84 &os_major_version,
85 &os_minor_version, 85 &os_minor_version,
86 &os_bugfix_version); 86 &os_bugfix_version);
87 EXPECT_EQ(-1, os_major_version); 87 EXPECT_EQ(-1, os_major_version);
88 EXPECT_EQ(-1, os_minor_version); 88 EXPECT_EQ(-1, os_minor_version);
89 EXPECT_EQ(-1, os_bugfix_version); 89 EXPECT_EQ(-1, os_bugfix_version);
90 } 90 }
91 91
92 #endif // OS_CHROMEOS 92 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « base/sys_info_chromeos.cc ('k') | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698