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

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

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/scoped_temp_dir.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/path_service.h" 14 #include "base/path_service.h"
14 #include "base/process_util.h" 15 #include "base/process_util.h"
15 #include "base/scoped_temp_dir.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
18 #include "chrome/installer/util/copy_tree_work_item.h" 18 #include "chrome/installer/util/copy_tree_work_item.h"
19 #include "chrome/installer/util/work_item.h" 19 #include "chrome/installer/util/work_item.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace { 22 namespace {
23 class CopyTreeWorkItemTest : public testing::Test { 23 class CopyTreeWorkItemTest : public testing::Test {
24 protected: 24 protected:
25 virtual void SetUp() { 25 virtual void SetUp() {
26 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 26 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
27 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); 27 ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
28 } 28 }
29 29
30 virtual void TearDown() { 30 virtual void TearDown() {
31 logging::CloseLogFile(); 31 logging::CloseLogFile();
32 } 32 }
33 33
34 // the path to temporary directory used to contain the test operations 34 // the path to temporary directory used to contain the test operations
35 ScopedTempDir test_dir_; 35 base::ScopedTempDir test_dir_;
36 ScopedTempDir temp_dir_; 36 base::ScopedTempDir temp_dir_;
37 }; 37 };
38 38
39 // Simple function to dump some text into a new file. 39 // Simple function to dump some text into a new file.
40 void CreateTextFile(const std::wstring& filename, 40 void CreateTextFile(const std::wstring& filename,
41 const std::wstring& contents) { 41 const std::wstring& contents) {
42 std::ofstream file; 42 std::ofstream file;
43 file.open(filename.c_str()); 43 file.open(filename.c_str());
44 ASSERT_TRUE(file.is_open()); 44 ASSERT_TRUE(file.is_open());
45 file << contents; 45 file << contents;
46 file.close(); 46 file.close();
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1)); 714 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1));
715 715
716 FilePath file_name_to_2(dir_name_to); 716 FilePath file_name_to_2(dir_name_to);
717 file_name_to_2 = file_name_to_2.AppendASCII("2"); 717 file_name_to_2 = file_name_to_2.AppendASCII("2");
718 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); 718 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt");
719 EXPECT_TRUE(file_util::PathExists(file_name_to_2)); 719 EXPECT_TRUE(file_util::PathExists(file_name_to_2));
720 VLOG(1) << "compare " << file_name_from_2.value() 720 VLOG(1) << "compare " << file_name_from_2.value()
721 << " and " << file_name_to_2.value(); 721 << " and " << file_name_to_2.value();
722 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2)); 722 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2));
723 } 723 }
OLDNEW
« no previous file with comments | « chrome/installer/util/copy_tree_work_item.h ('k') | chrome/installer/util/create_dir_work_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698