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 <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 <vector> | 9 #include <vector> |
9 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
10 #include "update_engine/utils.h" | 11 #include "update_engine/utils.h" |
11 | 12 |
| 13 using std::string; |
12 using std::vector; | 14 using std::vector; |
13 | 15 |
14 namespace chromeos_update_engine { | 16 namespace chromeos_update_engine { |
15 | 17 |
16 class UtilsTest : public ::testing::Test { }; | 18 class UtilsTest : public ::testing::Test { }; |
17 | 19 |
18 TEST(UtilsTest, NormalizePathTest) { | 20 TEST(UtilsTest, NormalizePathTest) { |
19 EXPECT_EQ("", utils::NormalizePath("", false)); | 21 EXPECT_EQ("", utils::NormalizePath("", false)); |
20 EXPECT_EQ("", utils::NormalizePath("", true)); | 22 EXPECT_EQ("", utils::NormalizePath("", true)); |
21 EXPECT_EQ("/", utils::NormalizePath("/", false)); | 23 EXPECT_EQ("/", utils::NormalizePath("/", false)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 105 |
104 TEST(UtilsTest, TempFilenameTest) { | 106 TEST(UtilsTest, TempFilenameTest) { |
105 const string original = "/foo.XXXXXX"; | 107 const string original = "/foo.XXXXXX"; |
106 const string result = utils::TempFilename(original); | 108 const string result = utils::TempFilename(original); |
107 EXPECT_EQ(original.size(), result.size()); | 109 EXPECT_EQ(original.size(), result.size()); |
108 EXPECT_TRUE(utils::StringHasPrefix(result, "/foo.")); | 110 EXPECT_TRUE(utils::StringHasPrefix(result, "/foo.")); |
109 EXPECT_FALSE(utils::StringHasSuffix(result, "XXXXXX")); | 111 EXPECT_FALSE(utils::StringHasSuffix(result, "XXXXXX")); |
110 } | 112 } |
111 | 113 |
112 } // namespace chromeos_update_engine | 114 } // namespace chromeos_update_engine |
OLD | NEW |