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 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/installer/util/duplicate_tree_detector.h" | 13 #include "chrome/installer/util/duplicate_tree_detector.h" |
14 #include "chrome/installer/util/installer_util_test_common.h" | 14 #include "chrome/installer/util/installer_util_test_common.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class DuplicateTreeDetectorTest : public testing::Test { | 19 class DuplicateTreeDetectorTest : public testing::Test { |
20 protected: | 20 protected: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ASSERT_TRUE(file_util::PathExists(d2)); | 53 ASSERT_TRUE(file_util::PathExists(d2)); |
54 | 54 |
55 FilePath f2(d2); | 55 FilePath f2(d2); |
56 f2 = f2.AppendASCII("F2"); | 56 f2 = f2.AppendASCII("F2"); |
57 CreateTextFile(f2.MaybeAsASCII(), text_content_2_); | 57 CreateTextFile(f2.MaybeAsASCII(), text_content_2_); |
58 ASSERT_TRUE(file_util::PathExists(f2)); | 58 ASSERT_TRUE(file_util::PathExists(f2)); |
59 | 59 |
60 ASSERT_TRUE(installer::test::CopyFileHierarchy(d1, second_root)); | 60 ASSERT_TRUE(installer::test::CopyFileHierarchy(d1, second_root)); |
61 } | 61 } |
62 | 62 |
63 ScopedTempDir temp_source_dir_; | 63 base::ScopedTempDir temp_source_dir_; |
64 ScopedTempDir temp_dest_dir_; | 64 base::ScopedTempDir temp_dest_dir_; |
65 | 65 |
66 static const wchar_t text_content_1_[]; | 66 static const wchar_t text_content_1_[]; |
67 static const wchar_t text_content_2_[]; | 67 static const wchar_t text_content_2_[]; |
68 static const wchar_t text_content_3_[]; | 68 static const wchar_t text_content_3_[]; |
69 }; | 69 }; |
70 | 70 |
71 const wchar_t DuplicateTreeDetectorTest::text_content_1_[] = | 71 const wchar_t DuplicateTreeDetectorTest::text_content_1_[] = |
72 L"Gooooooooooooooooooooogle"; | 72 L"Gooooooooooooooooooooogle"; |
73 const wchar_t DuplicateTreeDetectorTest::text_content_2_[] = | 73 const wchar_t DuplicateTreeDetectorTest::text_content_2_[] = |
74 L"Overwrite Me"; | 74 L"Overwrite Me"; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 ASSERT_TRUE(installer::test::CopyFileHierarchy(source_file, dest_file)); | 147 ASSERT_TRUE(installer::test::CopyFileHierarchy(source_file, dest_file)); |
148 | 148 |
149 // This file should be different. | 149 // This file should be different. |
150 FilePath other_file(temp_dest_dir_.path()); | 150 FilePath other_file(temp_dest_dir_.path()); |
151 other_file = other_file.AppendASCII("F2"); | 151 other_file = other_file.AppendASCII("F2"); |
152 CreateTextFile(other_file.MaybeAsASCII(), text_content_2_); | 152 CreateTextFile(other_file.MaybeAsASCII(), text_content_2_); |
153 | 153 |
154 EXPECT_TRUE(installer::IsIdenticalFileHierarchy(source_file, dest_file)); | 154 EXPECT_TRUE(installer::IsIdenticalFileHierarchy(source_file, dest_file)); |
155 EXPECT_FALSE(installer::IsIdenticalFileHierarchy(source_file, other_file)); | 155 EXPECT_FALSE(installer::IsIdenticalFileHierarchy(source_file, other_file)); |
156 } | 156 } |
OLD | NEW |