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

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

Issue 1763008: Windows: Make file_util::Delete("c:\\foo_dir", false) work correctly. Add more unit tests for Delete (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: re-upload patch set 4 Created 10 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <iostream> 8 #include <iostream>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 21 matching lines...) Expand all
32 // Create a tempory directory under the test directory. 32 // Create a tempory directory under the test directory.
33 temp_dir_ = test_dir_.AppendASCII("temp"); 33 temp_dir_ = test_dir_.AppendASCII("temp");
34 file_util::CreateDirectoryW(temp_dir_); 34 file_util::CreateDirectoryW(temp_dir_);
35 35
36 ASSERT_TRUE(file_util::PathExists(test_dir_)); 36 ASSERT_TRUE(file_util::PathExists(test_dir_));
37 ASSERT_TRUE(file_util::PathExists(temp_dir_)); 37 ASSERT_TRUE(file_util::PathExists(temp_dir_));
38 } 38 }
39 39
40 virtual void TearDown() { 40 virtual void TearDown() {
41 // Clean up test directory 41 // Clean up test directory
42 ASSERT_TRUE(file_util::Delete(test_dir_, false)); 42 ASSERT_TRUE(file_util::Delete(test_dir_, true));
43 ASSERT_FALSE(file_util::PathExists(test_dir_)); 43 ASSERT_FALSE(file_util::PathExists(test_dir_));
44 } 44 }
45 45
46 // the path to temporary directory used to contain the test operations 46 // the path to temporary directory used to contain the test operations
47 FilePath test_dir_; 47 FilePath test_dir_;
48 FilePath temp_dir_; 48 FilePath temp_dir_;
49 }; 49 };
50 50
51 // Simple function to dump some text into a new file. 51 // Simple function to dump some text into a new file.
52 void CreateTextFile(const std::wstring& filename, 52 void CreateTextFile(const std::wstring& filename,
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); 385 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file));
386 386
387 // test rollback() 387 // test rollback()
388 work_item->Rollback(); 388 work_item->Rollback();
389 389
390 EXPECT_TRUE(file_util::PathExists(from_dir)); 390 EXPECT_TRUE(file_util::PathExists(from_dir));
391 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); 391 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file));
392 EXPECT_TRUE(file_util::PathExists(to_dir)); 392 EXPECT_TRUE(file_util::PathExists(to_dir));
393 EXPECT_EQ(0, ReadTextFile(to_file.value()).compare(text_content_1)); 393 EXPECT_EQ(0, ReadTextFile(to_file.value()).compare(text_content_1));
394 } 394 }
OLDNEW
« no previous file with comments | « chrome/installer/util/lzma_util_unittest.cc ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698