OLD | NEW |
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 <windows.h> | 5 #include <windows.h> |
6 #include <wincrypt.h> | 6 #include <wincrypt.h> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 EXPECT_NE(FALSE, CryptGenRandom(crypt_ctx, arraysize(data), &data[0])); | 27 EXPECT_NE(FALSE, CryptGenRandom(crypt_ctx, arraysize(data), &data[0])); |
28 EXPECT_NE(FALSE, CryptReleaseContext(crypt_ctx, 0)); | 28 EXPECT_NE(FALSE, CryptReleaseContext(crypt_ctx, 0)); |
29 | 29 |
30 // Hexify the value. | 30 // Hexify the value. |
31 std::string result(base::HexEncode(&data[0], arraysize(data))); | 31 std::string result(base::HexEncode(&data[0], arraysize(data))); |
32 EXPECT_EQ(8, result.size()); | 32 EXPECT_EQ(8, result.size()); |
33 | 33 |
34 // Replace the first digit with the letter 'R' (for "random", get it?). | 34 // Replace the first digit with the letter 'R' (for "random", get it?). |
35 result[0] = 'R'; | 35 result[0] = 'R'; |
36 | 36 |
37 return ASCIIToWide(result); | 37 return base::ASCIIToWide(result); |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 namespace installer { | 42 namespace installer { |
43 | 43 |
44 class SelfCleaningTempDirTest : public testing::Test { | 44 class SelfCleaningTempDirTest : public testing::Test { |
45 }; | 45 }; |
46 | 46 |
47 // Test the implementation of GetTopDirToCreate when given the root of a | 47 // Test the implementation of GetTopDirToCreate when given the root of a |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 file_util::WriteFile(parent_temp_dir.Append(GetRandomFilename()), | 164 file_util::WriteFile(parent_temp_dir.Append(GetRandomFilename()), |
165 kHiHon, arraysize(kHiHon) - 1)); | 165 kHiHon, arraysize(kHiHon) - 1)); |
166 } | 166 } |
167 EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); | 167 EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); |
168 EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir)); | 168 EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir)); |
169 EXPECT_TRUE(work_dir.Delete()); | 169 EXPECT_TRUE(work_dir.Delete()); |
170 EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); | 170 EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); |
171 } | 171 } |
172 | 172 |
173 } // namespace installer | 173 } // namespace installer |
OLD | NEW |