| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/chromeos/chromeos_version_loader.h" | 5 #include "chrome/browser/chromeos/version_loader.h" |
| 6 |
| 7 #include <string> |
| 6 | 8 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 10 |
| 9 typedef testing::Test ChromeOSVersionLoaderTest; | 11 namespace chromeos { |
| 12 |
| 13 typedef testing::Test VersionLoaderTest; |
| 10 | 14 |
| 11 static const char kTest1[] = | 15 static const char kTest1[] = |
| 12 "DIST_ID=1\nCHROMEOS_RELEASE_DESCRIPTION=0.2.3.3\nFOO=BAR"; | 16 "DIST_ID=1\nCHROMEOS_RELEASE_DESCRIPTION=0.2.3.3\nFOO=BAR"; |
| 13 static const char kTest2[] = "DIST_ID=1\nCHROMEOS_RELEASE_DESCRIPTION=0.2.3.3"; | 17 static const char kTest2[] = "DIST_ID=1\nCHROMEOS_RELEASE_DESCRIPTION=0.2.3.3"; |
| 14 static const char kTest3[] = "CHROMEOS_RELEASE_DESCRIPTION=\"0.2.3.3\""; | 18 static const char kTest3[] = "CHROMEOS_RELEASE_DESCRIPTION=\"0.2.3.3\""; |
| 15 static const char kTest4[] = "CHROMEOS_RELEASE_DESCRIPTION=\"\"\""; | 19 static const char kTest4[] = "CHROMEOS_RELEASE_DESCRIPTION=\"\"\""; |
| 16 static const char kTest5[] = "CHROMEOS_RELEASE_DESCRIPTION=\"\""; | 20 static const char kTest5[] = "CHROMEOS_RELEASE_DESCRIPTION=\"\""; |
| 17 | 21 |
| 18 TEST_F(ChromeOSVersionLoaderTest, ParseVersion) { | 22 TEST_F(VersionLoaderTest, ParseVersion) { |
| 19 EXPECT_EQ("0.2.3.3", ChromeOSVersionLoader::ParseVersion(kTest1)); | 23 EXPECT_EQ("0.2.3.3", VersionLoader::ParseVersion(kTest1)); |
| 20 EXPECT_EQ("0.2.3.3", ChromeOSVersionLoader::ParseVersion(kTest2)); | 24 EXPECT_EQ("0.2.3.3", VersionLoader::ParseVersion(kTest2)); |
| 21 EXPECT_EQ("0.2.3.3", ChromeOSVersionLoader::ParseVersion(kTest3)); | 25 EXPECT_EQ("0.2.3.3", VersionLoader::ParseVersion(kTest3)); |
| 22 EXPECT_EQ("\"", ChromeOSVersionLoader::ParseVersion(kTest4)); | 26 EXPECT_EQ("\"", VersionLoader::ParseVersion(kTest4)); |
| 23 EXPECT_EQ(std::string(), ChromeOSVersionLoader::ParseVersion(kTest5)); | 27 EXPECT_EQ(std::string(), VersionLoader::ParseVersion(kTest5)); |
| 24 EXPECT_EQ(std::string(), ChromeOSVersionLoader::ParseVersion(std::string())); | 28 EXPECT_EQ(std::string(), VersionLoader::ParseVersion(std::string())); |
| 25 } | 29 } |
| 30 |
| 31 } // namespace chromeos |
| OLD | NEW |