OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 <sys/stat.h> | 5 #include <sys/stat.h> |
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
11 #include "update_engine/utils.h" | 11 #include "update_engine/utils.h" |
12 | 12 |
13 using std::string; | 13 using std::string; |
14 using std::vector; | 14 using std::vector; |
15 | 15 |
16 namespace chromeos_update_engine { | 16 namespace chromeos_update_engine { |
17 | 17 |
18 class UtilsTest : public ::testing::Test { }; | 18 class UtilsTest : public ::testing::Test { }; |
19 | 19 |
| 20 TEST(UtilsTest, IsOfficialBuild) { |
| 21 // Pretty lame test... |
| 22 EXPECT_TRUE(utils::IsOfficialBuild()); |
| 23 } |
| 24 |
20 TEST(UtilsTest, NormalizePathTest) { | 25 TEST(UtilsTest, NormalizePathTest) { |
21 EXPECT_EQ("", utils::NormalizePath("", false)); | 26 EXPECT_EQ("", utils::NormalizePath("", false)); |
22 EXPECT_EQ("", utils::NormalizePath("", true)); | 27 EXPECT_EQ("", utils::NormalizePath("", true)); |
23 EXPECT_EQ("/", utils::NormalizePath("/", false)); | 28 EXPECT_EQ("/", utils::NormalizePath("/", false)); |
24 EXPECT_EQ("", utils::NormalizePath("/", true)); | 29 EXPECT_EQ("", utils::NormalizePath("/", true)); |
25 EXPECT_EQ("/", utils::NormalizePath("//", false)); | 30 EXPECT_EQ("/", utils::NormalizePath("//", false)); |
26 EXPECT_EQ("", utils::NormalizePath("//", true)); | 31 EXPECT_EQ("", utils::NormalizePath("//", true)); |
27 EXPECT_EQ("foo", utils::NormalizePath("foo", false)); | 32 EXPECT_EQ("foo", utils::NormalizePath("foo", false)); |
28 EXPECT_EQ("foo", utils::NormalizePath("foo", true)); | 33 EXPECT_EQ("foo", utils::NormalizePath("foo", true)); |
29 EXPECT_EQ("/foo/", utils::NormalizePath("/foo//", false)); | 34 EXPECT_EQ("/foo/", utils::NormalizePath("/foo//", false)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 EXPECT_EQ("/dev/sda", utils::RootDevice("/dev/sda3")); | 134 EXPECT_EQ("/dev/sda", utils::RootDevice("/dev/sda3")); |
130 EXPECT_EQ("/dev/mmc0", utils::RootDevice("/dev/mmc0p3")); | 135 EXPECT_EQ("/dev/mmc0", utils::RootDevice("/dev/mmc0p3")); |
131 } | 136 } |
132 | 137 |
133 TEST(UtilsTest, PartitionNumberTest) { | 138 TEST(UtilsTest, PartitionNumberTest) { |
134 EXPECT_EQ("3", utils::PartitionNumber("/dev/sda3")); | 139 EXPECT_EQ("3", utils::PartitionNumber("/dev/sda3")); |
135 EXPECT_EQ("3", utils::PartitionNumber("/dev/mmc0p3")); | 140 EXPECT_EQ("3", utils::PartitionNumber("/dev/mmc0p3")); |
136 } | 141 } |
137 | 142 |
138 } // namespace chromeos_update_engine | 143 } // namespace chromeos_update_engine |
OLD | NEW |