Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/installer/util/duplicate_tree_detector_unittest.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 21 matching lines...) Expand all
32 file << contents; 32 file << contents;
33 file.close(); 33 file.close();
34 } 34 }
35 35
36 // Creates a two level deep source dir with a file in each in |first_root| and 36 // Creates a two level deep source dir with a file in each in |first_root| and
37 // copy it (files properties will be identical) in |second_root|. 37 // copy it (files properties will be identical) in |second_root|.
38 void CreateTwoIdenticalHierarchies(const base::FilePath& first_root, 38 void CreateTwoIdenticalHierarchies(const base::FilePath& first_root,
39 const base::FilePath& second_root) { 39 const base::FilePath& second_root) {
40 base::FilePath d1(first_root); 40 base::FilePath d1(first_root);
41 d1 = d1.AppendASCII("D1"); 41 d1 = d1.AppendASCII("D1");
42 file_util::CreateDirectory(d1); 42 base::CreateDirectory(d1);
43 ASSERT_TRUE(base::PathExists(d1)); 43 ASSERT_TRUE(base::PathExists(d1));
44 44
45 base::FilePath f1(d1); 45 base::FilePath f1(d1);
46 f1 = f1.AppendASCII("F1"); 46 f1 = f1.AppendASCII("F1");
47 CreateTextFile(f1.MaybeAsASCII(), text_content_1_); 47 CreateTextFile(f1.MaybeAsASCII(), text_content_1_);
48 ASSERT_TRUE(base::PathExists(f1)); 48 ASSERT_TRUE(base::PathExists(f1));
49 49
50 base::FilePath d2(d1); 50 base::FilePath d2(d1);
51 d2 = d2.AppendASCII("D2"); 51 d2 = d2.AppendASCII("D2");
52 file_util::CreateDirectory(d2); 52 base::CreateDirectory(d2);
53 ASSERT_TRUE(base::PathExists(d2)); 53 ASSERT_TRUE(base::PathExists(d2));
54 54
55 base::FilePath f2(d2); 55 base::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(base::PathExists(f2)); 58 ASSERT_TRUE(base::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
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 base::FilePath other_file(temp_dest_dir_.path()); 150 base::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 }
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_tree_work_item_unittest.cc ('k') | chrome/installer/util/install_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698