diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/sys_info_chromeos.cc | 11 | ||||
-rw-r--r-- | base/sys_info_unittest.cc | 14 |
2 files changed, 14 insertions, 11 deletions
diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc index cd17c18..f724f99 100644 --- a/base/sys_info_chromeos.cc +++ b/base/sys_info_chromeos.cc @@ -94,17 +94,20 @@ void SysInfo::ParseLsbRelease(const std::string& lsb_release, size_t length = lsb_release.find_first_of('\n', start_index) - start_index; std::string version = lsb_release.substr(start_index, length); StringTokenizer tokenizer(version, "."); - for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { - if (0 == i) { + // TODO(rkc): Ignore the 0. here; fix this once we move Chrome OS version + // numbers from the 0.xx.yyy.zz format to the xx.yyy.zz format. + // Refer to http://code.google.com/p/chromium-os/issues/detail?id=15789 + for (int i = 0; i < 4 && tokenizer.GetNext(); i++) { + if (1 == i) { StringToInt(tokenizer.token_begin(), tokenizer.token_end(), major_version); *minor_version = *bugfix_version = 0; - } else if (1 == i) { + } else if (2 == i) { StringToInt(tokenizer.token_begin(), tokenizer.token_end(), minor_version); - } else { // 2 == i + } else { // 3 == i StringToInt(tokenizer.token_begin(), tokenizer.token_end(), bugfix_version); diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc index 3e51890..06f21cc 100644 --- a/base/sys_info_unittest.cc +++ b/base/sys_info_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -67,9 +67,9 @@ TEST_F(SysInfoTest, GoogleChromeOSVersionNumbers) { &os_major_version, &os_minor_version, &os_bugfix_version); - EXPECT_EQ(1, os_major_version); - EXPECT_EQ(2, os_minor_version); - EXPECT_EQ(3, os_bugfix_version); + EXPECT_EQ(2, os_major_version); + EXPECT_EQ(3, os_minor_version); + EXPECT_EQ(4, os_bugfix_version); } TEST_F(SysInfoTest, GoogleChromeOSVersionNumbersFirst) { @@ -83,9 +83,9 @@ TEST_F(SysInfoTest, GoogleChromeOSVersionNumbersFirst) { &os_major_version, &os_minor_version, &os_bugfix_version); - EXPECT_EQ(1, os_major_version); - EXPECT_EQ(2, os_minor_version); - EXPECT_EQ(3, os_bugfix_version); + EXPECT_EQ(2, os_major_version); + EXPECT_EQ(3, os_minor_version); + EXPECT_EQ(4, os_bugfix_version); } TEST_F(SysInfoTest, GoogleChromeOSNoVersionNumbers) { |