| OLD | NEW |
| 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/browser/fileapi/async_file_test_helper.h" | 15 #include "webkit/browser/fileapi/async_file_test_helper.h" |
| 16 #include "webkit/browser/fileapi/file_system_backend.h" |
| 16 #include "webkit/browser/fileapi/file_system_context.h" | 17 #include "webkit/browser/fileapi/file_system_context.h" |
| 17 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
| 18 #include "webkit/browser/fileapi/file_system_operation.h" | 18 #include "webkit/browser/fileapi/file_system_operation.h" |
| 19 #include "webkit/browser/fileapi/file_system_url.h" | 19 #include "webkit/browser/fileapi/file_system_url.h" |
| 20 #include "webkit/browser/fileapi/mock_file_system_context.h" | 20 #include "webkit/browser/fileapi/mock_file_system_context.h" |
| 21 #include "webkit/browser/fileapi/test_file_set.h" | 21 #include "webkit/browser/fileapi/test_file_set.h" |
| 22 #include "webkit/browser/quota/mock_quota_manager.h" | 22 #include "webkit/browser/quota/mock_quota_manager.h" |
| 23 #include "webkit/browser/quota/quota_manager.h" | 23 #include "webkit/browser/quota/quota_manager.h" |
| 24 #include "webkit/common/fileapi/file_system_util.h" | 24 #include "webkit/common/fileapi/file_system_util.h" |
| 25 | 25 |
| 26 namespace fileapi { | 26 namespace fileapi { |
| 27 | 27 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 base_dir, | 61 base_dir, |
| 62 base::MessageLoopProxy::current().get(), | 62 base::MessageLoopProxy::current().get(), |
| 63 base::MessageLoopProxy::current().get(), | 63 base::MessageLoopProxy::current().get(), |
| 64 NULL /* special storage policy */); | 64 NULL /* special storage policy */); |
| 65 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( | 65 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( |
| 66 quota_manager_.get(), base::MessageLoopProxy::current().get()); | 66 quota_manager_.get(), base::MessageLoopProxy::current().get()); |
| 67 file_system_context_ = | 67 file_system_context_ = |
| 68 CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); | 68 CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); |
| 69 | 69 |
| 70 // Prepare the origin's root directory. | 70 // Prepare the origin's root directory. |
| 71 FileSystemMountPointProvider* mount_point_provider = | 71 FileSystemBackend* mount_point_provider = |
| 72 file_system_context_->GetMountPointProvider(src_type_); | 72 file_system_context_->GetFileSystemBackend(src_type_); |
| 73 mount_point_provider->OpenFileSystem( | 73 mount_point_provider->OpenFileSystem( |
| 74 origin_, src_type_, | 74 origin_, src_type_, |
| 75 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 75 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 76 base::Bind(&ExpectOk)); | 76 base::Bind(&ExpectOk)); |
| 77 mount_point_provider = | 77 mount_point_provider = |
| 78 file_system_context_->GetMountPointProvider(dest_type_); | 78 file_system_context_->GetFileSystemBackend(dest_type_); |
| 79 mount_point_provider->OpenFileSystem( | 79 mount_point_provider->OpenFileSystem( |
| 80 origin_, dest_type_, | 80 origin_, dest_type_, |
| 81 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 81 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 82 base::Bind(&ExpectOk)); | 82 base::Bind(&ExpectOk)); |
| 83 base::MessageLoop::current()->RunUntilIdle(); | 83 base::MessageLoop::current()->RunUntilIdle(); |
| 84 | 84 |
| 85 // Grant relatively big quota initially. | 85 // Grant relatively big quota initially. |
| 86 quota_manager_->SetQuota(origin_, | 86 quota_manager_->SetQuota(origin_, |
| 87 FileSystemTypeToQuotaStorageType(src_type_), | 87 FileSystemTypeToQuotaStorageType(src_type_), |
| 88 1024 * 1024); | 88 1024 * 1024); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 test::kRegularTestCaseSize); | 420 test::kRegularTestCaseSize); |
| 421 | 421 |
| 422 int64 src_new_usage = helper.GetSourceUsage(); | 422 int64 src_new_usage = helper.GetSourceUsage(); |
| 423 ASSERT_EQ(src_initial_usage, src_new_usage); | 423 ASSERT_EQ(src_initial_usage, src_new_usage); |
| 424 | 424 |
| 425 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 425 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 426 ASSERT_EQ(src_increase, dest_increase); | 426 ASSERT_EQ(src_increase, dest_increase); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace fileapi | 429 } // namespace fileapi |
| OLD | NEW |