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

Side by Side Diff: content/browser/fileapi/obfuscated_file_util_unittest.cc

Issue 259083002: Move mock_special_storage_policy from webkit/ to content/public/test/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file.h" 11 #include "base/files/file.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "content/browser/fileapi/mock_file_change_observer.h" 17 #include "content/browser/fileapi/mock_file_change_observer.h"
18 #include "content/public/test/async_file_test_helper.h" 18 #include "content/public/test/async_file_test_helper.h"
19 #include "content/public/test/mock_special_storage_policy.h"
19 #include "content/public/test/sandbox_file_system_test_helper.h" 20 #include "content/public/test/sandbox_file_system_test_helper.h"
20 #include "content/public/test/test_file_system_context.h" 21 #include "content/public/test/test_file_system_context.h"
21 #include "content/test/fileapi_test_file_set.h" 22 #include "content/test/fileapi_test_file_set.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "webkit/browser/fileapi/external_mount_points.h" 24 #include "webkit/browser/fileapi/external_mount_points.h"
24 #include "webkit/browser/fileapi/file_system_backend.h" 25 #include "webkit/browser/fileapi/file_system_backend.h"
25 #include "webkit/browser/fileapi/file_system_context.h" 26 #include "webkit/browser/fileapi/file_system_context.h"
26 #include "webkit/browser/fileapi/file_system_operation_context.h" 27 #include "webkit/browser/fileapi/file_system_operation_context.h"
27 #include "webkit/browser/fileapi/file_system_usage_cache.h" 28 #include "webkit/browser/fileapi/file_system_usage_cache.h"
28 #include "webkit/browser/fileapi/obfuscated_file_util.h" 29 #include "webkit/browser/fileapi/obfuscated_file_util.h"
29 #include "webkit/browser/fileapi/sandbox_directory_database.h" 30 #include "webkit/browser/fileapi/sandbox_directory_database.h"
30 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" 31 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
31 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h" 32 #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h"
32 #include "webkit/browser/fileapi/sandbox_origin_database.h" 33 #include "webkit/browser/fileapi/sandbox_origin_database.h"
33 #include "webkit/browser/quota/mock_special_storage_policy.h"
34 #include "webkit/browser/quota/quota_manager.h" 34 #include "webkit/browser/quota/quota_manager.h"
35 #include "webkit/common/database/database_identifier.h" 35 #include "webkit/common/database/database_identifier.h"
36 #include "webkit/common/quota/quota_types.h" 36 #include "webkit/common/quota/quota_types.h"
37 37
38 using content::AsyncFileTestHelper; 38 using content::AsyncFileTestHelper;
39 using fileapi::FileSystemContext; 39 using fileapi::FileSystemContext;
40 using fileapi::FileSystemOperation; 40 using fileapi::FileSystemOperation;
41 using fileapi::FileSystemOperationContext; 41 using fileapi::FileSystemOperationContext;
42 using fileapi::FileSystemType; 42 using fileapi::FileSystemType;
43 using fileapi::FileSystemURL; 43 using fileapi::FileSystemURL;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 type_(fileapi::kFileSystemTypeTemporary), 150 type_(fileapi::kFileSystemTypeTemporary),
151 weak_factory_(this), 151 weak_factory_(this),
152 sandbox_file_system_(origin_, type_), 152 sandbox_file_system_(origin_, type_),
153 quota_status_(quota::kQuotaStatusUnknown), 153 quota_status_(quota::kQuotaStatusUnknown),
154 usage_(-1) { 154 usage_(-1) {
155 } 155 }
156 156
157 virtual void SetUp() { 157 virtual void SetUp() {
158 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 158 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
159 159
160 storage_policy_ = new quota::MockSpecialStoragePolicy(); 160 storage_policy_ = new MockSpecialStoragePolicy();
161 161
162 quota_manager_ = 162 quota_manager_ =
163 new quota::QuotaManager(false /* is_incognito */, 163 new quota::QuotaManager(false /* is_incognito */,
164 data_dir_.path(), 164 data_dir_.path(),
165 base::MessageLoopProxy::current().get(), 165 base::MessageLoopProxy::current().get(),
166 base::MessageLoopProxy::current().get(), 166 base::MessageLoopProxy::current().get(),
167 storage_policy_.get()); 167 storage_policy_.get());
168 168
169 // Every time we create a new sandbox_file_system helper, 169 // Every time we create a new sandbox_file_system helper,
170 // it creates another context, which creates another path manager, 170 // it creates another context, which creates another path manager,
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 return sandbox_file_system_.file_system_context(); 798 return sandbox_file_system_.file_system_context();
799 } 799 }
800 800
801 const base::FilePath& data_dir_path() const { 801 const base::FilePath& data_dir_path() const {
802 return data_dir_.path(); 802 return data_dir_.path();
803 } 803 }
804 804
805 protected: 805 protected:
806 base::ScopedTempDir data_dir_; 806 base::ScopedTempDir data_dir_;
807 base::MessageLoop message_loop_; 807 base::MessageLoop message_loop_;
808 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy_; 808 scoped_refptr<MockSpecialStoragePolicy> storage_policy_;
809 scoped_refptr<quota::QuotaManager> quota_manager_; 809 scoped_refptr<quota::QuotaManager> quota_manager_;
810 scoped_refptr<FileSystemContext> file_system_context_; 810 scoped_refptr<FileSystemContext> file_system_context_;
811 GURL origin_; 811 GURL origin_;
812 fileapi::FileSystemType type_; 812 fileapi::FileSystemType type_;
813 base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_; 813 base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_;
814 SandboxFileSystemTestHelper sandbox_file_system_; 814 SandboxFileSystemTestHelper sandbox_file_system_;
815 quota::QuotaStatusCode quota_status_; 815 quota::QuotaStatusCode quota_status_;
816 int64 usage_; 816 int64 usage_;
817 fileapi::MockFileChangeObserver change_observer_; 817 fileapi::MockFileChangeObserver change_observer_;
818 fileapi::ChangeObserverList change_observers_; 818 fileapi::ChangeObserverList change_observers_;
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 false /* exclusive */, 2484 false /* exclusive */,
2485 true /* recursive */)); 2485 true /* recursive */));
2486 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, 2486 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
2487 ofu()->CreateDirectory(UnlimitedContext().get(), 2487 ofu()->CreateDirectory(UnlimitedContext().get(),
2488 path_in_file_in_file, 2488 path_in_file_in_file,
2489 false /* exclusive */, 2489 false /* exclusive */,
2490 true /* recursive */)); 2490 true /* recursive */));
2491 } 2491 }
2492 2492
2493 } // namespace content 2493 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_dir_url_request_job_unittest.cc ('k') | content/browser/indexed_db/indexed_db_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698