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

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

Issue 14096022: Make MountPointProvider pluggable from outside webkit/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix etc Created 7 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "webkit/fileapi/async_file_test_helper.h" 15 #include "webkit/fileapi/async_file_test_helper.h"
16 #include "webkit/fileapi/external_mount_points.h"
17 #include "webkit/fileapi/file_system_context.h" 16 #include "webkit/fileapi/file_system_context.h"
18 #include "webkit/fileapi/file_system_mount_point_provider.h" 17 #include "webkit/fileapi/file_system_mount_point_provider.h"
19 #include "webkit/fileapi/file_system_operation.h" 18 #include "webkit/fileapi/file_system_operation.h"
20 #include "webkit/fileapi/file_system_task_runners.h"
21 #include "webkit/fileapi/file_system_url.h" 19 #include "webkit/fileapi/file_system_url.h"
22 #include "webkit/fileapi/file_system_util.h" 20 #include "webkit/fileapi/file_system_util.h"
23 #include "webkit/fileapi/mock_file_system_options.h" 21 #include "webkit/fileapi/mock_file_system_context.h"
24 #include "webkit/fileapi/test_file_set.h" 22 #include "webkit/fileapi/test_file_set.h"
25 #include "webkit/quota/mock_quota_manager.h" 23 #include "webkit/quota/mock_quota_manager.h"
26 #include "webkit/quota/mock_special_storage_policy.h"
27 #include "webkit/quota/quota_manager.h" 24 #include "webkit/quota/quota_manager.h"
28 25
29 namespace fileapi { 26 namespace fileapi {
30 27
31 typedef FileSystemOperation::FileEntryList FileEntryList; 28 typedef FileSystemOperation::FileEntryList FileEntryList;
32 29
33 class CrossOperationTestHelper { 30 class CrossOperationTestHelper {
34 public: 31 public:
35 CrossOperationTestHelper( 32 CrossOperationTestHelper(
36 const GURL& origin, 33 const GURL& origin,
(...skipping 15 matching lines...) Expand all
52 ASSERT_TRUE(base_.CreateUniqueTempDir()); 49 ASSERT_TRUE(base_.CreateUniqueTempDir());
53 base::FilePath base_dir = base_.path(); 50 base::FilePath base_dir = base_.path();
54 quota_manager_ = new quota::MockQuotaManager( 51 quota_manager_ = new quota::MockQuotaManager(
55 false /* is_incognito */, base_dir, 52 false /* is_incognito */, base_dir,
56 base::MessageLoopProxy::current(), 53 base::MessageLoopProxy::current(),
57 base::MessageLoopProxy::current(), 54 base::MessageLoopProxy::current(),
58 NULL /* special storage policy */); 55 NULL /* special storage policy */);
59 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( 56 quota_manager_proxy_ = new quota::MockQuotaManagerProxy(
60 quota_manager_, 57 quota_manager_,
61 base::MessageLoopProxy::current()); 58 base::MessageLoopProxy::current());
62 file_system_context_ = new FileSystemContext( 59 file_system_context_ = CreateFileSystemContextForTesting(
63 FileSystemTaskRunners::CreateMockTaskRunners(),
64 ExternalMountPoints::CreateRefCounted().get(),
65 make_scoped_refptr(new quota::MockSpecialStoragePolicy),
66 quota_manager_proxy_, 60 quota_manager_proxy_,
67 base_dir, 61 base_dir);
68 CreateAllowFileAccessOptions());
69 62
70 // Prepare the origin's root directory. 63 // Prepare the origin's root directory.
71 FileSystemMountPointProvider* mount_point_provider = 64 FileSystemMountPointProvider* mount_point_provider =
72 file_system_context_->GetMountPointProvider(src_type_); 65 file_system_context_->GetMountPointProvider(src_type_);
73 mount_point_provider->GetFileSystemRootPathOnFileThread( 66 mount_point_provider->GetFileSystemRootPathOnFileThread(
74 SourceURL(std::string()), true /* create */); 67 SourceURL(std::string()), true /* create */);
75 mount_point_provider = 68 mount_point_provider =
76 file_system_context_->GetMountPointProvider(dest_type_); 69 file_system_context_->GetMountPointProvider(dest_type_);
77 mount_point_provider->GetFileSystemRootPathOnFileThread( 70 mount_point_provider->GetFileSystemRootPathOnFileThread(
78 DestURL(std::string()), true /* create */); 71 DestURL(std::string()), true /* create */);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 test::kRegularTestCaseSize); 407 test::kRegularTestCaseSize);
415 408
416 int64 src_new_usage = helper.GetSourceUsage(); 409 int64 src_new_usage = helper.GetSourceUsage();
417 ASSERT_EQ(src_initial_usage, src_new_usage); 410 ASSERT_EQ(src_initial_usage, src_new_usage);
418 411
419 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; 412 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage;
420 ASSERT_EQ(src_increase, dest_increase); 413 ASSERT_EQ(src_increase, dest_increase);
421 } 414 }
422 415
423 } // namespace fileapi 416 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.cc ('k') | webkit/fileapi/local_file_system_operation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698