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

Side by Side Diff: webkit/fileapi/obfuscated_file_util_unittest.cc

Issue 9564047: Add FileUtileHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/DeletePath/Delete/g Created 8 years, 9 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
« no previous file with comments | « webkit/fileapi/file_util_helper.cc ('k') | webkit/fileapi/quota_file_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/platform_file.h" 14 #include "base/platform_file.h"
15 #include "base/scoped_temp_dir.h" 15 #include "base/scoped_temp_dir.h"
16 #include "base/sys_string_conversions.h" 16 #include "base/sys_string_conversions.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "webkit/fileapi/file_system_context.h" 18 #include "webkit/fileapi/file_system_context.h"
19 #include "webkit/fileapi/file_system_operation_context.h" 19 #include "webkit/fileapi/file_system_operation_context.h"
20 #include "webkit/fileapi/file_system_test_helper.h" 20 #include "webkit/fileapi/file_system_test_helper.h"
21 #include "webkit/fileapi/file_system_usage_cache.h" 21 #include "webkit/fileapi/file_system_usage_cache.h"
22 #include "webkit/fileapi/file_util_helper.h"
22 #include "webkit/fileapi/mock_file_system_options.h" 23 #include "webkit/fileapi/mock_file_system_options.h"
23 #include "webkit/fileapi/obfuscated_file_util.h" 24 #include "webkit/fileapi/obfuscated_file_util.h"
24 #include "webkit/fileapi/test_file_set.h" 25 #include "webkit/fileapi/test_file_set.h"
25 #include "webkit/quota/mock_special_storage_policy.h" 26 #include "webkit/quota/mock_special_storage_policy.h"
26 #include "webkit/quota/quota_manager.h" 27 #include "webkit/quota/quota_manager.h"
27 #include "webkit/quota/quota_types.h" 28 #include "webkit/quota/quota_types.h"
28 29
29 using namespace fileapi; 30 using namespace fileapi;
30 31
31 namespace { 32 namespace {
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 test_helper().SameFileUtilCopy(context.get(), src_path, dest_path)); 1177 test_helper().SameFileUtilCopy(context.get(), src_path, dest_path));
1177 1178
1178 ValidateTestDirectory(dest_path, files, directories); 1179 ValidateTestDirectory(dest_path, files, directories);
1179 context.reset(NewContext(NULL)); 1180 context.reset(NewContext(NULL));
1180 EXPECT_TRUE(ofu()->DirectoryExists(context.get(), src_path)); 1181 EXPECT_TRUE(ofu()->DirectoryExists(context.get(), src_path));
1181 context.reset(NewContext(NULL)); 1182 context.reset(NewContext(NULL));
1182 EXPECT_TRUE(ofu()->DirectoryExists(context.get(), dest_path)); 1183 EXPECT_TRUE(ofu()->DirectoryExists(context.get(), dest_path));
1183 context.reset(NewContext(NULL)); 1184 context.reset(NewContext(NULL));
1184 recursive = true; 1185 recursive = true;
1185 ASSERT_EQ(base::PLATFORM_FILE_OK, 1186 ASSERT_EQ(base::PLATFORM_FILE_OK,
1186 ofu()->Delete(context.get(), dest_path, recursive)); 1187 FileUtilHelper::Delete(context.get(), ofu(),
1188 dest_path, recursive));
1187 context.reset(NewContext(NULL)); 1189 context.reset(NewContext(NULL));
1188 EXPECT_FALSE(ofu()->DirectoryExists(context.get(), dest_path)); 1190 EXPECT_FALSE(ofu()->DirectoryExists(context.get(), dest_path));
1189 } 1191 }
1190 1192
1191 TEST_F(ObfuscatedFileUtilTest, TestMigration) { 1193 TEST_F(ObfuscatedFileUtilTest, TestMigration) {
1192 ScopedTempDir source_dir; 1194 ScopedTempDir source_dir;
1193 ASSERT_TRUE(source_dir.CreateUniqueTempDir()); 1195 ASSERT_TRUE(source_dir.CreateUniqueTempDir());
1194 FilePath root_path = source_dir.path().AppendASCII("chrome-pLmnMWXE7NzTFRsn"); 1196 FilePath root_path = source_dir.path().AppendASCII("chrome-pLmnMWXE7NzTFRsn");
1195 ASSERT_TRUE(file_util::CreateDirectory(root_path)); 1197 ASSERT_TRUE(file_util::CreateDirectory(root_path));
1196 1198
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) { 1666 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) {
1665 TestDirectoryTimestampHelper( 1667 TestDirectoryTimestampHelper(
1666 CreatePathFromUTF8("copy overwrite"), true, true); 1668 CreatePathFromUTF8("copy overwrite"), true, true);
1667 TestDirectoryTimestampHelper( 1669 TestDirectoryTimestampHelper(
1668 CreatePathFromUTF8("copy non-overwrite"), true, false); 1670 CreatePathFromUTF8("copy non-overwrite"), true, false);
1669 TestDirectoryTimestampHelper( 1671 TestDirectoryTimestampHelper(
1670 CreatePathFromUTF8("move overwrite"), false, true); 1672 CreatePathFromUTF8("move overwrite"), false, true);
1671 TestDirectoryTimestampHelper( 1673 TestDirectoryTimestampHelper(
1672 CreatePathFromUTF8("move non-overwrite"), false, false); 1674 CreatePathFromUTF8("move non-overwrite"), false, false);
1673 } 1675 }
OLDNEW
« no previous file with comments | « webkit/fileapi/file_util_helper.cc ('k') | webkit/fileapi/quota_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698