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

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

Issue 7174002: Change {Obfuscated|Local}FileSystemFileUtil non-Singleton to take an underlying *FileUtil. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed memery leak at LocalFSFUTest, and rebased. Created 9 years, 6 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) 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "webkit/fileapi/file_system_context.h" 11 #include "webkit/fileapi/file_system_context.h"
12 #include "webkit/fileapi/file_system_operation_context.h" 12 #include "webkit/fileapi/file_system_operation_context.h"
13 #include "webkit/fileapi/file_system_test_helper.h" 13 #include "webkit/fileapi/file_system_test_helper.h"
14 #include "webkit/fileapi/local_file_system_file_util.h"
15 #include "webkit/fileapi/obfuscated_file_system_file_util.h" 14 #include "webkit/fileapi/obfuscated_file_system_file_util.h"
16 15
17 using namespace fileapi; 16 using namespace fileapi;
18 17
19 namespace { 18 namespace {
20 19
21 struct CopyMoveTestCaseRecord { 20 struct CopyMoveTestCaseRecord {
22 bool is_directory; 21 bool is_directory;
23 const FilePath::CharType path[64]; 22 const FilePath::CharType path[64];
24 int64 data_file_size; 23 int64 data_file_size;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return context; 68 return context;
70 } 69 }
71 70
72 void TestCrossFileSystemCopyMoveHelper( 71 void TestCrossFileSystemCopyMoveHelper(
73 const GURL& src_origin, fileapi::FileSystemType src_type, 72 const GURL& src_origin, fileapi::FileSystemType src_type,
74 const GURL& dest_origin, fileapi::FileSystemType dest_type, 73 const GURL& dest_origin, fileapi::FileSystemType dest_type,
75 bool copy) { 74 bool copy) {
76 ScopedTempDir base_dir; 75 ScopedTempDir base_dir;
77 ASSERT_TRUE(base_dir.CreateUniqueTempDir()); 76 ASSERT_TRUE(base_dir.CreateUniqueTempDir());
78 scoped_refptr<ObfuscatedFileSystemFileUtil> file_util( 77 scoped_refptr<ObfuscatedFileSystemFileUtil> file_util(
79 new ObfuscatedFileSystemFileUtil(base_dir.path())); 78 new ObfuscatedFileSystemFileUtil(base_dir.path(),
79 FileSystemFileUtil::GetInstance()));
80 FileSystemTestOriginHelper src_helper(src_origin, src_type); 80 FileSystemTestOriginHelper src_helper(src_origin, src_type);
81 src_helper.SetUp(base_dir.path(), 81 src_helper.SetUp(base_dir.path(),
82 false, // incognito 82 false, // incognito
83 false, // unlimited quota 83 false, // unlimited quota
84 NULL, // quota::QuotaManagerProxy 84 NULL, // quota::QuotaManagerProxy
85 file_util.get()); 85 file_util.get());
86 FileSystemTestOriginHelper dest_helper(dest_origin, dest_type); 86 FileSystemTestOriginHelper dest_helper(dest_origin, dest_type);
87 dest_helper.SetUp(src_helper.file_system_context(), NULL); 87 dest_helper.SetUp(src_helper.file_system_context(), NULL);
88 88
89 // Set up all the source data. 89 // Set up all the source data.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 TestCrossFileSystemCopyMoveHelper(src_origin, type, dest_origin, type, false); 197 TestCrossFileSystemCopyMoveHelper(src_origin, type, dest_origin, type, false);
198 } 198 }
199 199
200 TEST_F(FileSystemFileUtilTest, TestCrossFileSystemMoveSameOrigin) { 200 TEST_F(FileSystemFileUtilTest, TestCrossFileSystemMoveSameOrigin) {
201 GURL origin("http://www.example.com"); 201 GURL origin("http://www.example.com");
202 fileapi::FileSystemType src_type = kFileSystemTypePersistent; 202 fileapi::FileSystemType src_type = kFileSystemTypePersistent;
203 fileapi::FileSystemType dest_type = kFileSystemTypeTemporary; 203 fileapi::FileSystemType dest_type = kFileSystemTypeTemporary;
204 204
205 TestCrossFileSystemCopyMoveHelper(origin, src_type, origin, dest_type, false); 205 TestCrossFileSystemCopyMoveHelper(origin, src_type, origin, dest_type, false);
206 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698