| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "storage/browser/blob/blob_memory_controller.h" | 5 #include "storage/browser/blob/blob_memory_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 BlobStorageLimits limits; | 67 BlobStorageLimits limits; |
| 68 limits.max_ipc_memory_size = kTestBlobStorageIPCThresholdBytes; | 68 limits.max_ipc_memory_size = kTestBlobStorageIPCThresholdBytes; |
| 69 limits.max_shared_memory_size = kTestBlobStorageMaxSharedMemoryBytes; | 69 limits.max_shared_memory_size = kTestBlobStorageMaxSharedMemoryBytes; |
| 70 limits.max_blob_in_memory_space = kTestBlobStorageMaxBlobMemorySize; | 70 limits.max_blob_in_memory_space = kTestBlobStorageMaxBlobMemorySize; |
| 71 limits.max_blob_disk_space = kTestBlobStorageMaxDiskSpace; | 71 limits.max_blob_disk_space = kTestBlobStorageMaxDiskSpace; |
| 72 limits.min_page_file_size = kTestBlobStorageMinFileSizeBytes; | 72 limits.min_page_file_size = kTestBlobStorageMinFileSizeBytes; |
| 73 limits.max_file_size = kTestBlobStorageMaxFileSizeBytes; | 73 limits.max_file_size = kTestBlobStorageMaxFileSizeBytes; |
| 74 controller->set_limits_for_testing(limits); | 74 controller->set_limits_for_testing(limits); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void SaveFileCreationInfo(std::vector<FileCreationInfo> info, bool success) { | 77 void SaveFileCreationInfo(bool success, std::vector<FileCreationInfo> info) { |
| 78 file_quota_result_ = success; | 78 file_quota_result_ = success; |
| 79 if (success) { | 79 if (success) { |
| 80 files_created_.swap(info); | 80 files_created_.swap(info); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 void SaveMemoryRequest(bool success) { memory_quota_result_ = success; } | 84 void SaveMemoryRequest(bool success) { memory_quota_result_ = success; } |
| 85 | 85 |
| 86 BlobMemoryController::FileQuotaRequestCallback GetFileCreationCallback() { | 86 BlobMemoryController::FileQuotaRequestCallback GetFileCreationCallback() { |
| 87 return base::Bind(&BlobMemoryControllerTest::SaveFileCreationInfo, | 87 return base::Bind(&BlobMemoryControllerTest::SaveFileCreationInfo, |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 file_items.clear(); | 671 file_items.clear(); |
| 672 items.clear(); | 672 items.clear(); |
| 673 | 673 |
| 674 RunFileThreadTasks(); | 674 RunFileThreadTasks(); |
| 675 base::RunLoop().RunUntilIdle(); | 675 base::RunLoop().RunUntilIdle(); |
| 676 | 676 |
| 677 EXPECT_EQ(0ull, controller.disk_usage()); | 677 EXPECT_EQ(0ull, controller.disk_usage()); |
| 678 EXPECT_EQ(0ull, controller.memory_usage()); | 678 EXPECT_EQ(0ull, controller.memory_usage()); |
| 679 } | 679 } |
| 680 } // namespace storage | 680 } // namespace storage |
| OLD | NEW |