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

Unified Diff: chrome/installer/util/copy_tree_work_item_unittest.cc

Issue 497083004: Change base/file_utils.h includes to base/files/file_utils.h in chrome/, part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@file_util
Patch Set: Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/copy_tree_work_item.cc ('k') | chrome/installer/util/create_dir_work_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/copy_tree_work_item_unittest.cc
diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc
index 72bdc567172e6bb3d685e746d0a618427cff055e..d89a03a7823f249d0bb3b4e8e2c75ed96cbe2791 100644
--- a/chrome/installer/util/copy_tree_work_item_unittest.cc
+++ b/chrome/installer/util/copy_tree_work_item_unittest.cc
@@ -7,7 +7,7 @@
#include <fstream>
#include "base/base_paths.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -19,59 +19,61 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
- class CopyTreeWorkItemTest : public testing::Test {
- protected:
- virtual void SetUp() {
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
- }
-
- virtual void TearDown() {
- logging::CloseLogFile();
- }
-
- // the path to temporary directory used to contain the test operations
- base::ScopedTempDir test_dir_;
- base::ScopedTempDir temp_dir_;
- };
-
- // Simple function to dump some text into a new file.
- void CreateTextFile(const std::wstring& filename,
- const std::wstring& contents) {
- std::ofstream file;
- file.open(filename.c_str());
- ASSERT_TRUE(file.is_open());
- file << contents;
- file.close();
+
+class CopyTreeWorkItemTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
}
- bool IsFileInUse(const base::FilePath& path) {
- if (!base::PathExists(path))
- return false;
+ virtual void TearDown() {
+ logging::CloseLogFile();
+ }
- HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS,
- NULL, NULL, OPEN_EXISTING, NULL, NULL);
- if (handle == INVALID_HANDLE_VALUE)
- return true;
+ // the path to temporary directory used to contain the test operations
+ base::ScopedTempDir test_dir_;
+ base::ScopedTempDir temp_dir_;
+};
- CloseHandle(handle);
+// Simple function to dump some text into a new file.
+void CreateTextFile(const std::wstring& filename,
+ const std::wstring& contents) {
+ std::ofstream file;
+ file.open(filename.c_str());
+ ASSERT_TRUE(file.is_open());
+ file << contents;
+ file.close();
+}
+
+bool IsFileInUse(const base::FilePath& path) {
+ if (!base::PathExists(path))
return false;
- }
- // Simple function to read text from a file.
- std::wstring ReadTextFile(const std::wstring& filename) {
- WCHAR contents[64];
- std::wifstream file;
- file.open(filename.c_str());
- EXPECT_TRUE(file.is_open());
- file.getline(contents, 64);
- file.close();
- return std::wstring(contents);
- }
+ HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS,
+ NULL, NULL, OPEN_EXISTING, NULL, NULL);
+ if (handle == INVALID_HANDLE_VALUE)
+ return true;
- wchar_t text_content_1[] = L"Gooooooooooooooooooooogle";
- wchar_t text_content_2[] = L"Overwrite Me";
-};
+ CloseHandle(handle);
+ return false;
+}
+
+// Simple function to read text from a file.
+std::wstring ReadTextFile(const std::wstring& filename) {
+ WCHAR contents[64];
+ std::wifstream file;
+ file.open(filename.c_str());
+ EXPECT_TRUE(file.is_open());
+ file.getline(contents, 64);
+ file.close();
+ return std::wstring(contents);
+}
+
+const wchar_t text_content_1[] = L"Gooooooooooooooooooooogle";
+const wchar_t text_content_2[] = L"Overwrite Me";
+
+} // namespace
// Copy one file from source to destination.
TEST_F(CopyTreeWorkItemTest, CopyFile) {
« no previous file with comments | « chrome/installer/util/copy_tree_work_item.cc ('k') | chrome/installer/util/create_dir_work_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698