| OLD | NEW |
| 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 "webkit/browser/fileapi/local_file_system_operation.h" | 5 #include "webkit/browser/fileapi/local_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 public: | 52 public: |
| 53 LocalFileSystemOperationTest() | 53 LocalFileSystemOperationTest() |
| 54 : status_(kFileOperationStatusNotSet) {} | 54 : status_(kFileOperationStatusNotSet) {} |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 virtual void SetUp() OVERRIDE { | 57 virtual void SetUp() OVERRIDE { |
| 58 EXPECT_TRUE(base_.CreateUniqueTempDir()); | 58 EXPECT_TRUE(base_.CreateUniqueTempDir()); |
| 59 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); | 59 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); |
| 60 | 60 |
| 61 base::FilePath base_dir = base_.path().AppendASCII("filesystem"); | 61 base::FilePath base_dir = base_.path().AppendASCII("filesystem"); |
| 62 quota_manager_ = new quota::MockQuotaManager( | 62 quota_manager_ = |
| 63 false /* is_incognito */, base_dir, | 63 new quota::MockQuotaManager(false /* is_incognito */, |
| 64 base::MessageLoopProxy::current(), | 64 base_dir, |
| 65 base::MessageLoopProxy::current(), | 65 base::MessageLoopProxy::current().get(), |
| 66 NULL /* special storage policy */); | 66 base::MessageLoopProxy::current().get(), |
| 67 NULL /* special storage policy */); |
| 67 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( | 68 quota_manager_proxy_ = new quota::MockQuotaManagerProxy( |
| 68 quota_manager(), | 69 quota_manager(), base::MessageLoopProxy::current().get()); |
| 69 base::MessageLoopProxy::current()); | |
| 70 sandbox_file_system_.SetUp(base_dir, quota_manager_proxy_.get()); | 70 sandbox_file_system_.SetUp(base_dir, quota_manager_proxy_.get()); |
| 71 sandbox_file_system_.file_system_context()->sandbox_provider()-> | 71 sandbox_file_system_.file_system_context()->sandbox_provider()-> |
| 72 AddFileChangeObserver(sandbox_file_system_.type(), | 72 AddFileChangeObserver(sandbox_file_system_.type(), |
| 73 &change_observer_, | 73 &change_observer_, |
| 74 NULL); | 74 NULL); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual void TearDown() OVERRIDE { | 77 virtual void TearDown() OVERRIDE { |
| 78 // Let the client go away before dropping a ref of the quota manager proxy. | 78 // Let the client go away before dropping a ref of the quota manager proxy. |
| 79 quota_manager_proxy()->SimulateQuotaManagerDestroyed(); | 79 quota_manager_proxy()->SimulateQuotaManagerDestroyed(); |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 base::MessageLoop::current()->RunUntilIdle(); | 1182 base::MessageLoop::current()->RunUntilIdle(); |
| 1183 | 1183 |
| 1184 expected_usage += grandchild_file_size + grandchild_path_cost; | 1184 expected_usage += grandchild_file_size + grandchild_path_cost; |
| 1185 usage = GetUsage(); | 1185 usage = GetUsage(); |
| 1186 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, | 1186 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, |
| 1187 GetDataSizeOnDisk()); | 1187 GetDataSizeOnDisk()); |
| 1188 EXPECT_EQ(expected_usage, usage); | 1188 EXPECT_EQ(expected_usage, usage); |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 } // namespace fileapi | 1191 } // namespace fileapi |
| OLD | NEW |